[pypy-commit] pypy py3.3-fixes3: add .name attribute for all instances of shaXXX classes

numerodix noreply at buildbot.pypy.org
Mon Aug 18 01:05:46 CEST 2014


Author: Martin Matusiak <numerodix at gmail.com>
Branch: py3.3-fixes3
Changeset: r72862:98b3c0bab1fe
Date: 2014-08-17 20:14 +0200
http://bitbucket.org/pypy/pypy/changeset/98b3c0bab1fe/

Log:	add .name attribute for all instances of shaXXX classes

diff --git a/lib_pypy/_sha1.py b/lib_pypy/_sha1.py
--- a/lib_pypy/_sha1.py
+++ b/lib_pypy/_sha1.py
@@ -123,6 +123,8 @@
     def __init__(self):
         "Initialisation."
 
+        self.name = 'sha'
+
         # Initial message length in bits(!).
         self.length = 0
         self.count = [0, 0]
@@ -349,6 +351,7 @@
     """
 
     crypto = sha()
+    crypto.name = 'sha1'
     if arg:
         crypto.update(arg)
 
diff --git a/lib_pypy/_sha256.py b/lib_pypy/_sha256.py
--- a/lib_pypy/_sha256.py
+++ b/lib_pypy/_sha256.py
@@ -208,6 +208,7 @@
     block_size = SHA_BLOCKSIZE
 
     def __init__(self, s=None):
+        self.name = 'sha256'
         self._sha = sha_init()
         if s:
             sha_update(self._sha, s)
@@ -230,6 +231,7 @@
     digest_size = digestsize = 28
 
     def __init__(self, s=None):
+        self.name = 'sha224'
         self._sha = sha224_init()
         if s:
             sha_update(self._sha, s)
diff --git a/lib_pypy/_sha512.py b/lib_pypy/_sha512.py
--- a/lib_pypy/_sha512.py
+++ b/lib_pypy/_sha512.py
@@ -236,6 +236,7 @@
     block_size = SHA_BLOCKSIZE
 
     def __init__(self, s=None):
+        self.name = 'sha512'
         self._sha = sha_init()
         if s:
             sha_update(self._sha, s)
@@ -258,6 +259,7 @@
     digest_size = digestsize = 48
 
     def __init__(self, s=None):
+        self.name = 'sha384'
         self._sha = sha384_init()
         if s:
             sha_update(self._sha, s)


More information about the pypy-commit mailing list