OLD | NEW |
(Empty) | |
| 1 # -*- coding: utf-8 -*- |
| 2 # |
| 3 # =================================================================== |
| 4 # The contents of this file are dedicated to the public domain. To |
| 5 # the extent that dedication to the public domain is not available, |
| 6 # everyone is granted a worldwide, perpetual, royalty-free, |
| 7 # non-exclusive license to exercise all rights associated with the |
| 8 # contents of this file for any purpose whatsoever. |
| 9 # No rights are reserved. |
| 10 # |
| 11 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 12 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 13 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 14 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 15 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 16 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 17 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 18 # SOFTWARE. |
| 19 # =================================================================== |
| 20 |
| 21 """Hashing algorithms |
| 22 |
| 23 Hash functions take arbitrary binary strings as input, and produce a random-like
output |
| 24 of fixed size that is dependent on the input; it should be practically infeasibl
e |
| 25 to derive the original input data given only the hash function's |
| 26 output. In other words, the hash function is *one-way*. |
| 27 |
| 28 It should also not be practically feasible to find a second piece of data |
| 29 (a *second pre-image*) whose hash is the same as the original message |
| 30 (*weak collision resistance*). |
| 31 |
| 32 Finally, it should not be feasible to find two arbitrary messages with the |
| 33 same hash (*strong collision resistance*). |
| 34 |
| 35 The output of the hash function is called the *digest* of the input message. |
| 36 In general, the security of a hash function is related to the length of the |
| 37 digest. If the digest is *n* bits long, its security level is roughly comparable |
| 38 to the the one offered by an *n/2* bit encryption algorithm. |
| 39 |
| 40 Hash functions can be used simply as a integrity check, or, in |
| 41 association with a public-key algorithm, can be used to implement |
| 42 digital signatures. |
| 43 |
| 44 The hashing modules here all support the interface described in `PEP |
| 45 247`_ , "API for Cryptographic Hash Functions". |
| 46 |
| 47 .. _`PEP 247` : http://www.python.org/dev/peps/pep-0247/ |
| 48 |
| 49 :undocumented: _MD2, _MD4, _RIPEMD160, _SHA224, _SHA256, _SHA384, _SHA512 |
| 50 """ |
| 51 |
| 52 __all__ = ['HMAC', 'MD2', 'MD4', 'MD5', 'RIPEMD', 'SHA', |
| 53 'SHA224', 'SHA256', 'SHA384', 'SHA512'] |
| 54 __revision__ = "$Id$" |
| 55 |
| 56 |
OLD | NEW |