Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 1 | Message Digests |
Alex Gaynor | ddc62f0 | 2013-10-20 06:14:24 -0700 | [diff] [blame] | 2 | =============== |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 3 | |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 4 | .. class:: cryptography.primitives.hashes.BaseHash |
| 5 | |
Paul Kehrer | 6b9ddeb | 2013-10-19 12:28:15 -0500 | [diff] [blame] | 6 | Abstract base class that implements a common interface for all hash |
| 7 | algorithms that follow here. |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 8 | |
Paul Kehrer | 6b9ddeb | 2013-10-19 12:28:15 -0500 | [diff] [blame] | 9 | .. method:: update(data) |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 10 | |
Alex Gaynor | ddc62f0 | 2013-10-20 06:14:24 -0700 | [diff] [blame] | 11 | :param bytes data: The bytes you wish to hash. |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 12 | |
| 13 | .. method:: copy() |
| 14 | |
Paul Kehrer | 6b9ddeb | 2013-10-19 12:28:15 -0500 | [diff] [blame] | 15 | :return: a new instance of this object with a copied internal state. |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 16 | |
| 17 | .. method:: digest() |
| 18 | |
| 19 | :return bytes: The message digest as bytes. |
| 20 | |
| 21 | .. method:: hexdigest() |
| 22 | |
| 23 | :return str: The message digest as hex. |
| 24 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 25 | SHA-1 |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 26 | ~~~~~ |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 27 | |
| 28 | .. attention:: |
| 29 | |
| 30 | NIST has deprecated SHA-1 in favor of the SHA-2 variants. New applications |
| 31 | are strongly suggested to use SHA-2 over SHA-1. |
| 32 | |
| 33 | .. class:: cryptography.primitives.hashes.SHA1() |
| 34 | |
| 35 | SHA-1 is a cryptographic hash function standardized by NIST. It has a |
| 36 | 160-bit message digest. |
| 37 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 38 | SHA-2 Family |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 39 | ~~~~~~~~~~~~ |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 40 | |
| 41 | .. class:: cryptography.primitives.hashes.SHA224() |
| 42 | |
| 43 | SHA-224 is a cryptographic hash function from the SHA-2 family and |
| 44 | standardized by NIST. It has a 224-bit message digest. |
| 45 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 46 | .. class:: cryptography.primitives.hashes.SHA256() |
| 47 | |
| 48 | SHA-256 is a cryptographic hash function from the SHA-2 family and |
| 49 | standardized by NIST. It has a 256-bit message digest. |
| 50 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 51 | .. class:: cryptography.primitives.hashes.SHA384() |
| 52 | |
| 53 | SHA-384 is a cryptographic hash function from the SHA-2 family and |
| 54 | standardized by NIST. It has a 384-bit message digest. |
| 55 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 56 | .. class:: cryptography.primitives.hashes.SHA512() |
| 57 | |
| 58 | SHA-512 is a cryptographic hash function from the SHA-2 family and |
| 59 | standardized by NIST. It has a 512-bit message digest. |
| 60 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 61 | RIPEMD160 |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 62 | ~~~~~~~~~ |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 63 | |
| 64 | .. class:: cryptography.primitives.hashes.RIPEMD160() |
| 65 | |
| 66 | RIPEMD160 is a cryptographic hash function that is part of ISO/IEC |
| 67 | 10118-3:2004. It has a 160-bit message digest. |
| 68 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 69 | Whirlpool |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 70 | ~~~~~~~~~ |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 71 | |
| 72 | .. class:: cryptography.primitives.hashes.Whirlpool() |
| 73 | |
| 74 | Whirlpool is a cryptographic hash function that is part of ISO/IEC |
| 75 | 10118-3:2004. It has a 512-bit message digest. |
| 76 | |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 77 | MD5 |
Matthew Iversen | 505491b | 2013-10-19 15:56:17 +1100 | [diff] [blame] | 78 | ~~~ |
Paul Kehrer | 36e7d0d | 2013-10-18 18:54:40 -0500 | [diff] [blame] | 79 | |
| 80 | .. warning:: |
| 81 | |
| 82 | MD5 is a deprecated hash algorithm that has practical known collision |
| 83 | attacks. You are strongly discouraged from using it. |
| 84 | |
| 85 | .. class:: cryptography.primitives.hashes.MD5() |
| 86 | |
| 87 | MD5 is a deprecated cryptographic hash function. It has a 160-bit message |
| 88 | digest and has practical known collision attacks. |