[Checkins] SVN: Zope/branches/gsoc-python-2.5/utilities/mkzopeinstance.py sha -> hashlib

Philipp von Weitershausen philipp at weitershausen.de
Wed Oct 15 17:19:10 EDT 2008


Andreas Jung wrote:
> Log message for revision 92197:
>   sha -> hashlib
>   
> 
> Changed:
>   U   Zope/branches/gsoc-python-2.5/utilities/mkzopeinstance.py
> 
> -=-
> Modified: Zope/branches/gsoc-python-2.5/utilities/mkzopeinstance.py
> ===================================================================
> --- Zope/branches/gsoc-python-2.5/utilities/mkzopeinstance.py	2008-10-14 14:45:35 UTC (rev 92196)
> +++ Zope/branches/gsoc-python-2.5/utilities/mkzopeinstance.py	2008-10-14 15:22:29 UTC (rev 92197)
> @@ -167,9 +167,9 @@
>  
>  def write_inituser(fn, user, password):
>      import binascii
> -    import sha
> +    import hashlib
>      fp = open(fn, "w")
> -    pw = binascii.b2a_base64(sha.new(password).digest())[:-1]
> +    pw = binascii.b2a_base64(hashlib.sha256(password).digest())[:-1]
>      fp.write('%s:{SHA}%s\n' % (user, pw))
>      fp.close()
>      os.chmod(fn, 0644)

To my knowledge, sha.new() and hashlib.sha256() aren't equivalent. A 
quick test on the interpeter prompt confirms that, though perhaps I'm 
missing something... Is there a particular reason why you chose 
hashlib.sha256() and not hashlib.sha1() which seems to be the equivalent 
to sha.new()?


More information about the Checkins mailing list