Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between 'character' and 'octet' in hashing

I see the term 'octet' popping up in literature about nonces for hashing, and it seems to be synonymous with 'character', although there is a kind of pattern to how the words are used.

This leads me to believe that there is a formal distinction between the two. If anyone could enlighten me to what it is, I'd appreciate it.

(and please, no lectures about octal character codes or octal (base 8) numbers; I'm talking about the noun 'octet', not the adjective)

EDIT: as it turns out, the word I was looking for, is 'octet'.

like image 794
Jens Roland Avatar asked Jan 25 '09 19:01

Jens Roland


3 Answers

You are probably thinking about the term octet that is often used to be synonymous with a single-byte (non-unicode) character. Octet in this instance means eight bits. A character can be eight or sixteen or even more bits, but an octet is always eight bits.

like image 103
Eddie Avatar answered Nov 06 '22 17:11

Eddie


An octet is an 8-bit piece of data, a byte (though bytes don't necessarily have 8 bits). A character is the smallest unit of text. They are completely separate concepts, and using them interchangeably betrays serious ignorance of the complexity of text encodings. Unfortunately, this particular element of ignorance is far too common, and that the C standard explicitly defines a char to have a size of 1 byte does not help.

In particular, I'd be very wary of any cryptographic text that uses "character" to mean "byte" (or "octet").

like image 36
Michael Borgwardt Avatar answered Nov 06 '22 15:11

Michael Borgwardt


Octet is the french word for a byte, it is called octet because it contains eight bits. The term is used mainly in telecommunications, probably due to the heavy french influence in e.g. CCITT.

like image 31
starblue Avatar answered Nov 06 '22 16:11

starblue