Basic Encoding Rules (BER)

Basic Encoding Rules (BER), Kurose & Ross (2010, p798-799), ensure that byte streams sent over a network are sent correctly if the object has been defined using ASN.1. The BER encoding of the quoted text would use a 4 at the beginning to indicate that the data is an octet string, followed by a 4 which represents the length of the octet string (i.e. the number of characters in “greg”), next follows the octet string of 4 ASCII characters and finally a 2 to represent that the following data are integers and another 2 to represent the length of the big-endian representation of the weight and finally the big-endian representation of the weight. The binary for 277 is 00010101 which as we are using a base representation of 256, this is split into 1 (x 256) and 21 for the value over 256. The final BER encoded byte stream is ‘44greg22121’.

References

Kurose & Ross (2010) Computer Networking: A Top-Down Approach (Fifth Edition). Addison Wesley.