Add rationale section

This commit is contained in:
Andrew M. Kuchling 2001-10-22 02:10:29 +00:00
parent 65fa39f94a
commit 4aaafae02a
1 changed files with 18 additions and 0 deletions

View File

@ -115,6 +115,24 @@ Specification
'\x90\x01P\x98<\xd2O\xb0\xd6\x96?}(\xe1\x7fr'
Rationale
The digest size is measured in bytes, not bits, even though hash
algorithm sizes are usually quoted in bits; MD5 is a 128-bit
algorithm and not a 16-byte one, for example. This is because, in
the sample code I looked at, the length in bytes is often needed
(to seek ahead or behind in a file; to compute the length of an
output string) while the length in bits is rarely used.
Therefore, the burden will fall on the few people actually needing
the size in bits, who will have to multiply digest_size by 8.
It's been suggested that the update() method would be better named
append(). However, that method is really causing the current
state of the hashing object to be updated, and update() is already
used by the md5 and sha modules included with Python, so it seems
simplest to leave the name update() alone.
Changes
2001-09-17: Renamed clear() to reset(); added digest_size attribute