blob: 6e8f601ba9bf279b990a92b453c3a1442f1de0cd [file] [log] [blame]
Paul Kehrer36e7d0d2013-10-18 18:54:40 -05001Message Digests
2====================
3
Matthew Iversen505491b2013-10-19 15:56:17 +11004.. class:: cryptography.primitives.hashes.BaseHash
5
6 Abstract base class that implements a common interface for
7 all hash algorithms that follow here
8
9 .. method:: update(string)
10
11 :param bytes string: The bytes you wish to hash.
12
13 .. method:: copy()
14
15 :return: a new instance of this object with a
16 copied internal state.
17
18 .. method:: digest()
19
20 :return bytes: The message digest as bytes.
21
22 .. method:: hexdigest()
23
24 :return str: The message digest as hex.
25
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050026SHA-1
Matthew Iversen505491b2013-10-19 15:56:17 +110027~~~~~
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050028
29.. attention::
30
31 NIST has deprecated SHA-1 in favor of the SHA-2 variants. New applications
32 are strongly suggested to use SHA-2 over SHA-1.
33
34.. class:: cryptography.primitives.hashes.SHA1()
35
36 SHA-1 is a cryptographic hash function standardized by NIST. It has a
37 160-bit message digest.
38
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050039SHA-2 Family
Matthew Iversen505491b2013-10-19 15:56:17 +110040~~~~~~~~~~~~
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050041
42.. class:: cryptography.primitives.hashes.SHA224()
43
44 SHA-224 is a cryptographic hash function from the SHA-2 family and
45 standardized by NIST. It has a 224-bit message digest.
46
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050047.. class:: cryptography.primitives.hashes.SHA256()
48
49 SHA-256 is a cryptographic hash function from the SHA-2 family and
50 standardized by NIST. It has a 256-bit message digest.
51
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050052.. class:: cryptography.primitives.hashes.SHA384()
53
54 SHA-384 is a cryptographic hash function from the SHA-2 family and
55 standardized by NIST. It has a 384-bit message digest.
56
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050057.. class:: cryptography.primitives.hashes.SHA512()
58
59 SHA-512 is a cryptographic hash function from the SHA-2 family and
60 standardized by NIST. It has a 512-bit message digest.
61
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050062RIPEMD160
Matthew Iversen505491b2013-10-19 15:56:17 +110063~~~~~~~~~
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050064
65.. class:: cryptography.primitives.hashes.RIPEMD160()
66
67 RIPEMD160 is a cryptographic hash function that is part of ISO/IEC
68 10118-3:2004. It has a 160-bit message digest.
69
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050070Whirlpool
Matthew Iversen505491b2013-10-19 15:56:17 +110071~~~~~~~~~
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050072
73.. class:: cryptography.primitives.hashes.Whirlpool()
74
75 Whirlpool is a cryptographic hash function that is part of ISO/IEC
76 10118-3:2004. It has a 512-bit message digest.
77
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050078MD5
Matthew Iversen505491b2013-10-19 15:56:17 +110079~~~
Paul Kehrer36e7d0d2013-10-18 18:54:40 -050080
81.. warning::
82
83 MD5 is a deprecated hash algorithm that has practical known collision
84 attacks. You are strongly discouraged from using it.
85
86.. class:: cryptography.primitives.hashes.MD5()
87
88 MD5 is a deprecated cryptographic hash function. It has a 160-bit message
89 digest and has practical known collision attacks.