blob: 1499f762dcb85e1c29176c3fa05d497d0e4d3bf9 [file] [log] [blame]
Paul Kehrer36e7d0d2013-10-18 18:54:40 -05001Message Digests
2====================
3
4SHA-1
5~~~~~~~
6
7.. attention::
8
9 NIST has deprecated SHA-1 in favor of the SHA-2 variants. New applications
10 are strongly suggested to use SHA-2 over SHA-1.
11
12.. class:: cryptography.primitives.hashes.SHA1()
13
14 SHA-1 is a cryptographic hash function standardized by NIST. It has a
15 160-bit message digest.
16
17 .. method:: update(string)
18
19 :param bytes string: The bytes you wish to hash.
20
21 .. method:: digest()
22
23 :return bytes: The message digest as bytes.
24
25 .. method:: hexdigest()
26
27 :return str: The message digest as hex.
28
29
30SHA-2 Family
31~~~~~~~
32
33.. class:: cryptography.primitives.hashes.SHA224()
34
35 SHA-224 is a cryptographic hash function from the SHA-2 family and
36 standardized by NIST. It has a 224-bit message digest.
37
38 .. method:: update(string)
39
40 :param bytes string: The bytes you wish to hash.
41
42 .. method:: digest()
43
44 :return bytes: The message digest as bytes.
45
46 .. method:: hexdigest()
47
48 :return str: The message digest as hex.
49
50.. class:: cryptography.primitives.hashes.SHA256()
51
52 SHA-256 is a cryptographic hash function from the SHA-2 family and
53 standardized by NIST. It has a 256-bit message digest.
54
55 .. method:: update(string)
56
57 :param bytes string: The bytes you wish to hash.
58
59 .. method:: digest()
60
61 :return bytes: The message digest as bytes.
62
63 .. method:: hexdigest()
64
65 :return str: The message digest as hex.
66
67.. class:: cryptography.primitives.hashes.SHA384()
68
69 SHA-384 is a cryptographic hash function from the SHA-2 family and
70 standardized by NIST. It has a 384-bit message digest.
71
72 .. method:: update(string)
73
74 :param bytes string: The bytes you wish to hash.
75
76 .. method:: digest()
77
78 :return bytes: The message digest as bytes.
79
80 .. method:: hexdigest()
81
82 :return str: The message digest as hex.
83
84.. class:: cryptography.primitives.hashes.SHA512()
85
86 SHA-512 is a cryptographic hash function from the SHA-2 family and
87 standardized by NIST. It has a 512-bit message digest.
88
89 .. method:: update(string)
90
91 :param bytes string: The bytes you wish to hash.
92
93 .. method:: digest()
94
95 :return bytes: The message digest as bytes.
96
97 .. method:: hexdigest()
98
99 :return str: The message digest as hex.
100
101RIPEMD160
102~~~~~~~
103
104.. class:: cryptography.primitives.hashes.RIPEMD160()
105
106 RIPEMD160 is a cryptographic hash function that is part of ISO/IEC
107 10118-3:2004. It has a 160-bit message digest.
108
109 .. method:: update(string)
110
111 :param bytes string: The bytes you wish to hash.
112
113 .. method:: digest()
114
115 :return bytes: The message digest as bytes.
116
117 .. method:: hexdigest()
118
119 :return str: The message digest as hex.
120
121Whirlpool
122~~~~~~~
123
124.. class:: cryptography.primitives.hashes.Whirlpool()
125
126 Whirlpool is a cryptographic hash function that is part of ISO/IEC
127 10118-3:2004. It has a 512-bit message digest.
128
129 .. method:: update(string)
130
131 :param bytes string: The bytes you wish to hash.
132
133 .. method:: digest()
134
135 :return bytes: The message digest as bytes.
136
137 .. method:: hexdigest()
138
139 :return str: The message digest as hex.
140
141MD5
142~~~~~~~
143
144.. warning::
145
146 MD5 is a deprecated hash algorithm that has practical known collision
147 attacks. You are strongly discouraged from using it.
148
149.. class:: cryptography.primitives.hashes.MD5()
150
151 MD5 is a deprecated cryptographic hash function. It has a 160-bit message
152 digest and has practical known collision attacks.
153
154 .. method:: update(string)
155
156 :param bytes string: The bytes you wish to hash.
157
158 .. method:: digest()
159
160 :return bytes: The message digest as bytes.
161
162 .. method:: hexdigest()
163
164 :return str: The message digest as hex.