Clarify description of update() (Boyd Roberts)

Clarify description of new (Tim Peters)
This commit is contained in:
Andrew M. Kuchling 2001-09-24 15:37:19 +00:00
parent a307f83a41
commit 407ce7575f
1 changed files with 15 additions and 11 deletions

View File

@ -26,15 +26,17 @@ Specification
new([string])
new([key] , [string])
Create a new hashing object and return it. You can now feed
arbitrary strings into the object using its update() method,
and can ask for the hash value at any time by calling its
digest() method.
The 'string' parameter, if supplied, will be immediately
hashed into the object's starting state; an empty string or
None. For keyed hashes such as HMAC, 'key' is a string
containing the starting key.
Create a new hashing object and return it. The first form is
for hashes that are unkeyed; most hashes such as MD5 or SHA
are unkeyed. For keyed hashes such as HMAC, 'key' is a string
containing the starting key. The 'string' parameter, if
supplied, will be immediately hashed into the object's
starting state, as if obj.update(string) was called.
After creating a hashing object, arbitrary strings can be fed
into the object using its update() method, and the hash value
can be obtained at any time by calling the object's digest()
method.
Arbitrary additional keyword arguments can be added to this
function, but if they're not supplied, sensible default values
@ -88,9 +90,11 @@ Specification
for the digits 'a' through 'f'. Like the .digest() method, this
method mustn't alter the object.
update(arg)
update(string)
Update this hashing object with the string 'arg'.
Hash 'string' into the current state of the hashing object.
update() can be called any number of times during a hashing
object's lifetime.
Hashing modules can define additional module-level functions or
object methods and still be compliant with this specification.