Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 63 lines (42 sloc) 1.58 kB
f074542 @bjornedstrom Fix README.
authored
1 # python-sha3 (0.1 beta)
2 October 3, 2012
771c8e5 @bjornedstrom Initial implementation of sha3 module.
authored
3
f074542 @bjornedstrom Fix README.
authored
4 This module implements SHA-3 (also known as Keccak) with a
5 `hashlib`-like interface.
6
7 The module is written as a Python C extension on top of the reference
2b7fd77 @bjornedstrom docs: Spelling and grammar.
authored
8 implementation. This yields better performance than the pure Python
9 implementation that is available on the Keccak website.
771c8e5 @bjornedstrom Initial implementation of sha3 module.
authored
10
11 Sample usage:
12
13 import sha3
14 s = sha3.SHA3512() # also 224, 256, 384, 512
2e90921 @bjornedstrom Update README with patching info.
authored
15 # also exposed as the function sha3.sha3_512(...)
771c8e5 @bjornedstrom Initial implementation of sha3 module.
authored
16 s.update('foo')
17 print s.hexdigest()
18
2b7fd77 @bjornedstrom docs: Spelling and grammar.
authored
19 Importing the `sha3` module will also add the new modules to `hashlib`.
2e90921 @bjornedstrom Update README with patching info.
authored
20
21 >>> import hashlib
22 >>> import sha3
23 >>> hashlib.sha3_512('foo')
24 <sha3.SHA3512 object at 0x7fcd0fcb7590>
25
1e6f7e5 @bjornedstrom Fix README.
authored
26 ## Building
771c8e5 @bjornedstrom Initial implementation of sha3 module.
authored
27
28 python setup.py build
29
2b7fd77 @bjornedstrom docs: Spelling and grammar.
authored
30 This will require a C compiler, as usual, and also the Python
f074542 @bjornedstrom Fix README.
authored
31 development headers.
32
0004d8f @bjornedstrom README: build instructions for debian.
authored
33 Optionally, if you want to build a debian package:
34
35 debuild -d -us -uc
36
6b6c1e9 @bjornedstrom Update README with unit test info.
authored
37 ## Testing
38
2e90921 @bjornedstrom Update README with patching info.
authored
39 The `test/` directory contains a bunch of unit tests. By convention
6b6c1e9 @bjornedstrom Update README with unit test info.
authored
40 the runnable unit tests have a name that begins with `test_`, such as
41 the `test/test_usage.py` suite. You can run all the tests with
42 nosetests:
43
44 $ nosetests test/
45 ...
46 Ran 1088 tests in 0.155s
47 OK
48
1e6f7e5 @bjornedstrom Fix README.
authored
49 ## Caveats
771c8e5 @bjornedstrom Initial implementation of sha3 module.
authored
50
f074542 @bjornedstrom Fix README.
authored
51 While reference Keccak is tweakable and can hash bit strings, this
52 module has the same API as the python `hashlib` module and work on
53 bytes only.
54
2b7fd77 @bjornedstrom docs: Spelling and grammar.
authored
55 The current implementation most likely has a bug or two, though the
56 unit test coverage is fairly extensive.
f074542 @bjornedstrom Fix README.
authored
57
58 ## More Information
59
60 Please refer to the Keccak website for more information:
771c8e5 @bjornedstrom Initial implementation of sha3 module.
authored
61
f074542 @bjornedstrom Fix README.
authored
62 http://keccak.noekeon.org/
Something went wrong with that request. Please try again.