Octet String: What is it?

前端 未结 7 2057
萌比男神i
萌比男神i 2020-12-24 11:39

I am starting to look into some network programming concepts for a project I am about to take over, and I keep running into this concept of an octet string. Can anyone out

相关标签:
7条回答
  • 2020-12-24 12:21

    Suppose a representation of binary 00000000 to 11111111 as 0x00 to 0xFF in hexadecimal. Then the octetString is simply 00 to FF.

    Combining several octets to a string is then like 0x00 0x01 0x02 ... or simply 000102.. as an octetstring.

    Binary files can be encoded into octetstrings and sent from a webbclient to a server in the form of an ASCII-string containing the 0-F alphabet, like a8b9457fc6e3e410589f or it's capitals. There are javascript using BASE-64 encoding used to store pictures in Strings. The larger alphabet, in this case(I think ) A-Z,a-z,0-9, the less data needs to be transferred. every octet has 256 different possible values, and are to be stored in an alphabet of 62 letters, clearly one needs to use more than one letter / octet. Possibly the theoretical number is proportional to log62(256).

    The conclusion is that improved readability takes more space than it's binary version, in the octetstream example it's twice as long since each ascii char is eight bits and 2 chars (16 bits) represent an octet which is eight bits. Quite inefficient.

    0 讨论(0)
提交回复
热议问题