summaryrefslogtreecommitdiff
path: root/src/SHA384.c
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-02-17 11:21:38 -0800
committerDwayne Litzenberger <dlitz@dlitz.net>2013-02-17 20:07:02 -0800
commitfd398a28e3a227a539b264a9f1e11287b904c7da (patch)
tree9f1628ef88c17604f55ec0ad652b0e1fb3959f38 /src/SHA384.c
parent0d8ea5ff1607a3d7ae544667bff99229954484ff (diff)
downloadpycrypto-fd398a28e3a227a539b264a9f1e11287b904c7da.tar.gz
Hash: Speed up initialization by removing pure-Python wrappershash-speedup-wip
The pure Python wrappers around Crypto.Hash.* were convenient, but they slowed down hash initialization by 4-7x. There is a speed trade-off here: The MD5 and SHA1 objects are just wrapped hashlib objects (or old-style md5/sha objects). To maintain API compatibility with the rest of PyCrypto, we still have to wrap them, so they're slower to initialize than the rest of the hash functions. If hashlib ever adds a .new() method, we will automatically use hashlib directly and gain the initialization speed-up.
Diffstat (limited to 'src/SHA384.c')
-rw-r--r--src/SHA384.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/SHA384.c b/src/SHA384.c
index 24b200c..eb7051e 100644
--- a/src/SHA384.c
+++ b/src/SHA384.c
@@ -27,13 +27,28 @@
*
*/
-#define MODULE_NAME _SHA384
-#define ALGORITHM_NAME "SHA384"
+#define MODULE_NAME SHA384
#define DIGEST_SIZE (384/8)
#define BLOCK_SIZE (1024/8)
#define WORD_SIZE 8
#define SCHEDULE_SIZE 80
+static char MODULE__doc__[] =
+ "SHA-384 cryptographic hash algorithm.\n"
+ "\n"
+ "SHA-384 belongs to the SHA-2_ family of cryptographic hashes.\n"
+ "It produces the 384 bit digest of a message.\n"
+ "\n"
+ " >>> from Crypto.Hash import SHA384\n"
+ " >>>\n"
+ " >>> h = SHA384.new()\n"
+ " >>> h.update(b'Hello')\n"
+ " >>> print h.hexdigest()\n"
+ "\n"
+ "*SHA* stands for Secure Hash Algorithm.\n"
+ "\n"
+ ".. _SHA-2: http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf\n";
+
#include "hash_SHA2.h"
/* Initial Values H */