Add rationale section
This commit is contained in:
parent
65fa39f94a
commit
4aaafae02a
18
pep-0247.txt
18
pep-0247.txt
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue