[Python-checkins] CVS: python/nondist/peps pep-0247.txt,1.4,1.5

A.M. Kuchling akuchling@users.sourceforge.net
2001年9月20日 08:48:04 -0700


Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv20442
Modified Files:
	pep-0247.txt 
Log Message:
Removed the reset() method
Renamed digestsize to digest_size
Swap order of key, string arguments to new()
Various minor rewrites
Index: pep-0247.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0247.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pep-0247.txt	2001年09月17日 15:09:37	1.4
--- pep-0247.txt	2001年09月20日 15:48:02	1.5
***************
*** 6,10 ****
 Type: Informational
 Created: 23-Mar-2001
! Post-History:
 
 Abstract
--- 6,10 ----
 Type: Informational
 Created: 23-Mar-2001
! Post-History: 20-Sep-2001
 
 Abstract
***************
*** 24,28 ****
 Hash function modules define one function:
 
! new([string], [key])
 
 Create a new hashing object and return it. You can now feed
--- 24,29 ----
 Hash function modules define one function:
 
! new([string])
! new([key] , [string])
 
 Create a new hashing object and return it. You can now feed
***************
*** 38,69 ****
 Arbitrary additional keyword arguments can be added to this
 function, but if they're not supplied, sensible default values
! should be used. For example, 'rounds' and 'digestsize' could
! be added for a hash function which supports a different output
! size and a different number of rounds. 
 
 Hash function modules define one variable:
 
! digestsize
 
 An integer value; the size of the digest produced by the
 hashing objects created by this module, measured in bytes.
 You could also obtain this value by creating a sample object
! and accessing its 'digestsize' attribute, but it can be
 convenient to have this value available from the module.
 Hashes with a variable output size will set this variable to 0.
 
! The attributes of a hashing object are:
 
! digestsize
 
! An integer value; the size of the digest produced by the
 hashing object, measured in bytes. If the hash has a variable
! output size, this output size must be chosen when the
! hashing object is created, and this attribute must contain the
 selected size. Therefore 0 is *not* a legal value for this
 attribute.
 
 
! The methods for hashing objects are always the following:
 
 copy()
--- 39,72 ----
 Arbitrary additional keyword arguments can be added to this
 function, but if they're not supplied, sensible default values
! should be used. For example, 'rounds' and 'digest_size'
! keywords could be added for a hash function which supports a
! variable number of rounds and several different output sizes,
! and they should default to values believed to be secure.
 
 Hash function modules define one variable:
 
! digest_size
 
 An integer value; the size of the digest produced by the
 hashing objects created by this module, measured in bytes.
 You could also obtain this value by creating a sample object
! and accessing its 'digest_size' attribute, but it can be
 convenient to have this value available from the module.
 Hashes with a variable output size will set this variable to 0.
 
! Hashing objects require a single attribute:
 
! digest_size
 
! This attribute is identical to the module-level digest_size
! variable, measuring the size of the digest produced by the
 hashing object, measured in bytes. If the hash has a variable
! output size, this output size must be chosen when the hashing
! object is created, and this attribute must contain the
 selected size. Therefore 0 is *not* a legal value for this
 attribute.
 
 
! Hashing objects require the following methods:
 
 copy()
***************
*** 86,111 ****
 method mustn't alter the object.
 
- reset()
- 
- Reset this hashing object to its initial state, as if the
- object was created from new(key=<initially specified key>)
- (XXX what should this do for a keyed hash? A proposed
- semantic follows:). There is no way to supply a starting
- string as there is for the new() function, and there's no way
- to change the key specified for a keyed hash.
- 
 update(arg)
 
 Update this hashing object with the string 'arg'.
 
! For convenience, hashing objects also have a digest_size
! attribute, measuring the size of the resulting digest in bytes.
! This is identical to the module-level digest_size variable.
! 
 Here's an example, using a module named 'MD5':
 
 >>> from Crypto.Hash import MD5
 >>> m = MD5.new()
! >>> m.digestsize
 16
 >>> m.update('abc')
--- 89,104 ----
 method mustn't alter the object.
 
 update(arg)
 
 Update this hashing object with the string 'arg'.
 
! Hashing modules can define additional module-level functions or 
! object methods and still be compliant with this specification.
! 
 Here's an example, using a module named 'MD5':
 
 >>> from Crypto.Hash import MD5
 >>> m = MD5.new()
! >>> m.digest_size
 16
 >>> m.update('abc')
***************
*** 114,119 ****
 >>> m.hexdigest()
 '900150983cd24fb0d6963f7d28e17f72' 
- Or, more compactly:
- 
 >>> MD5.new('abc').digest()
 '\x90\x01P\x98<\xd2O\xb0\xd6\x96?}(\xe1\x7fr' 
--- 107,110 ----
***************
*** 122,133 ****
 Changes
 
! 2001年09月17日: Renamed clear() to reset; added digestsize attribute
 to objects; added .hexdigest() method.
 
 
 Acknowledgements
 
! Thanks to Andrew Archibald, Rich Salz, and the readers of the
! python-crypto list for their comments on this PEP.
 
 
--- 113,126 ----
 Changes
 
! 2001年09月17日: Renamed clear() to reset(); added digest_size attribute
 to objects; added .hexdigest() method.
+ 2001年09月20日: Removed reset() method completely.
 
 
 Acknowledgements
 
! Thanks to Andrew Archibald, Rich Salz, Itamar Shtull-Trauring, and
! the readers of the python-crypto list for their comments on this
! PEP.
 
 

AltStyle によって変換されたページ (->オリジナル) /