[pypy-svn] r46992 - in pypy/dist/pypy/module/sha: . test

arigo at codespeak.net arigo at codespeak.net
Fri Sep 28 11:21:33 CEST 2007


Author: arigo
Date: Fri Sep 28 11:21:33 2007
New Revision: 46992

Added:
   pypy/dist/pypy/module/sha/
      - copied from r46987, pypy/dist/pypy/module/md5/
   pypy/dist/pypy/module/sha/interp_sha.py
      - copied, changed from r46987, pypy/dist/pypy/module/md5/interp_md5.py
   pypy/dist/pypy/module/sha/test/test_sha.py
      - copied, changed from r46987, pypy/dist/pypy/module/md5/test/test_md5.py
Removed:
   pypy/dist/pypy/module/sha/interp_md5.py
   pypy/dist/pypy/module/sha/test/test_md5.py
Modified:
   pypy/dist/pypy/module/sha/__init__.py
Log:
An interp-level sha module for PyPy, copied from pypy/module/md5.


Modified: pypy/dist/pypy/module/sha/__init__.py
==============================================================================
--- pypy/dist/pypy/module/md5/__init__.py	(original)
+++ pypy/dist/pypy/module/sha/__init__.py	Fri Sep 28 11:21:33 2007
@@ -1,8 +1,8 @@
 
 """
-Mixed-module definition for the md5 module.
-Note that there is also a pure Python implementation in pypy/lib/md5.py;
-the present mixed-module version of md5 takes precedence if it is enabled.
+Mixed-module definition for the sha module.
+Note that there is also a pure Python implementation in pypy/lib/sha.py;
+the present mixed-module version of sha takes precedence if it is enabled.
 """
 
 from pypy.interpreter.mixedmodule import MixedModule
@@ -10,19 +10,21 @@
 
 class Module(MixedModule):
     """\
-This module implements the interface to RSA's MD5 message digest
-algorithm (see also Internet RFC 1321). Its use is quite
-straightforward: use new() to create an md5 object. You can now feed
-this object with arbitrary strings using the update() method, and at any
-point you can ask it for the digest (a strong kind of 128-bit checksum,
-a.k.a. ``fingerprint'') of the concatenation of the strings fed to it so
-far using the digest() method."""
+This module implements the interface to NIST's secure hash algorithm,
+known as SHA-1. SHA-1 is an improved version of the original SHA hash
+algorithm. It is used in the same way as the md5 module: use new() to
+create an sha object, then feed this object with arbitrary strings using
+the update() method, and at any point you can ask it for the digest of
+the concatenation of the strings fed to it so far. SHA-1 digests are 160
+bits instead of MD5's 128 bits."""
 
     interpleveldefs = {
-        'md5': 'interp_md5.W_MD5',
-        'new': 'interp_md5.W_MD5',
-        'MD5Type': 'interp_md5.W_MD5',
-        'digest_size': 'space.wrap(16)',
+        'sha': 'interp_sha.W_SHA',
+        'new': 'interp_sha.W_SHA',
+        'SHAType': 'interp_sha.W_SHA',
+        'blocksize': 'space.wrap(1)',
+        'digest_size': 'space.wrap(20)',
+        'digestsize': 'space.wrap(20)',
         }
 
     appleveldefs = {



More information about the Pypy-commit mailing list