为什么要将字节数组转换为十六进制字符串?
Why to convert byte array to hex string?
我在很多语言中遇到过一些将字节数组转换为十六进制字符串的算法实现:
How to convert a byte array to a hex string in Java?
How do you convert buffer (byte array) to hex string in C?
How can I convert a hex string to a byte array?
为什么经常使用这种转换?
字节数组存储为十六进制字符串有什么好处?
例如:
- 以不支持二进制的格式存储在文件中,例如CSV.
- 要存储在不支持二进制的数据库字段中。
- 发送不支持二进制的协议。
- 嵌入其他不支持二进制的内容,例如XML 和 JSON.
- 显示给用户。
- 许多其他原因...
我在很多语言中遇到过一些将字节数组转换为十六进制字符串的算法实现:
How to convert a byte array to a hex string in Java?
How do you convert buffer (byte array) to hex string in C?
How can I convert a hex string to a byte array?
为什么经常使用这种转换?
字节数组存储为十六进制字符串有什么好处?
例如:
- 以不支持二进制的格式存储在文件中,例如CSV.
- 要存储在不支持二进制的数据库字段中。
- 发送不支持二进制的协议。
- 嵌入其他不支持二进制的内容,例如XML 和 JSON.
- 显示给用户。
- 许多其他原因...