Author: Jason White [github@jasonwhite.io]
Hash: ceb8cb00ba51c98e61c4d20586fbd73fc7dd6511
Timestamp: Wed, 01 Jul 2020 03:45:47 +0000 (4 years ago)

+37 -41 +/-3 browse
Update sha2 crate to v0.9
1diff --git a/Cargo.lock b/Cargo.lock
2index db5e9e5..56004f4 100644
3--- a/Cargo.lock
4+++ b/Cargo.lock
5 @@ -139,21 +139,10 @@ dependencies = [
6
7 [[package]]
8 name = "block-buffer"
9- version = "0.7.3"
10- source = "registry+https://github.com/rust-lang/crates.io-index"
11- dependencies = [
12- "block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
13- "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
14- "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
15- "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
16- ]
17-
18- [[package]]
19- name = "block-padding"
20- version = "0.1.5"
21+ version = "0.9.0"
22 source = "registry+https://github.com/rust-lang/crates.io-index"
23 dependencies = [
24- "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
25+ "generic-array 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)",
26 ]
27
28 [[package]]
29 @@ -162,11 +151,6 @@ version = "0.2.0"
30 source = "registry+https://github.com/rust-lang/crates.io-index"
31
32 [[package]]
33- name = "byte-tools"
34- version = "0.3.1"
35- source = "registry+https://github.com/rust-lang/crates.io-index"
36-
37- [[package]]
38 name = "byteorder"
39 version = "1.3.4"
40 source = "registry+https://github.com/rust-lang/crates.io-index"
41 @@ -239,6 +223,11 @@ version = "0.1.5"
42 source = "registry+https://github.com/rust-lang/crates.io-index"
43
44 [[package]]
45+ name = "cpuid-bool"
46+ version = "0.1.0"
47+ source = "registry+https://github.com/rust-lang/crates.io-index"
48+
49+ [[package]]
50 name = "crossbeam-deque"
51 version = "0.7.3"
52 source = "registry+https://github.com/rust-lang/crates.io-index"
53 @@ -335,10 +324,10 @@ dependencies = [
54
55 [[package]]
56 name = "digest"
57- version = "0.8.1"
58+ version = "0.9.0"
59 source = "registry+https://github.com/rust-lang/crates.io-index"
60 dependencies = [
61- "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
62+ "generic-array 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)",
63 ]
64
65 [[package]]
66 @@ -439,10 +428,11 @@ dependencies = [
67
68 [[package]]
69 name = "generic-array"
70- version = "0.12.3"
71+ version = "0.14.2"
72 source = "registry+https://github.com/rust-lang/crates.io-index"
73 dependencies = [
74 "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
75+ "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
76 ]
77
78 [[package]]
79 @@ -810,7 +800,7 @@ dependencies = [
80
81 [[package]]
82 name = "opaque-debug"
83- version = "0.2.3"
84+ version = "0.3.0"
85 source = "registry+https://github.com/rust-lang/crates.io-index"
86
87 [[package]]
88 @@ -1059,7 +1049,7 @@ dependencies = [
89 "derive_more 0.99.9 (registry+https://github.com/rust-lang/crates.io-index)",
90 "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
91 "futures-backoff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
92- "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
93+ "generic-array 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)",
94 "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
95 "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
96 "human-size 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
97 @@ -1073,7 +1063,7 @@ dependencies = [
98 "rusoto_s3 0.40.0 (registry+https://github.com/rust-lang/crates.io-index)",
99 "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
100 "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
101- "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
102+ "sha2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
103 "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
104 "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
105 "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
106 @@ -1256,13 +1246,14 @@ dependencies = [
107
108 [[package]]
109 name = "sha2"
110- version = "0.8.1"
111+ version = "0.9.1"
112 source = "registry+https://github.com/rust-lang/crates.io-index"
113 dependencies = [
114- "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
115- "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
116- "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
117- "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
118+ "block-buffer 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
119+ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
120+ "cpuid-bool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
121+ "digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
122+ "opaque-debug 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
123 ]
124
125 [[package]]
126 @@ -1712,6 +1703,11 @@ version = "0.1.5"
127 source = "registry+https://github.com/rust-lang/crates.io-index"
128
129 [[package]]
130+ name = "version_check"
131+ version = "0.9.2"
132+ source = "registry+https://github.com/rust-lang/crates.io-index"
133+
134+ [[package]]
135 name = "want"
136 version = "0.2.0"
137 source = "registry+https://github.com/rust-lang/crates.io-index"
138 @@ -1817,10 +1813,8 @@ dependencies = [
139 "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
140 "checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
141 "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab"
142- "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
143- "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
144+ "checksum block-buffer 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
145 "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40"
146- "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
147 "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
148 "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
149 "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
150 @@ -1830,6 +1824,7 @@ dependencies = [
151 "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
152 "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
153 "checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
154+ "checksum cpuid-bool 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d375c433320f6c5057ae04a04376eef4d04ce2801448cf8863a78da99107be4"
155 "checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
156 "checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
157 "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
158 @@ -1840,7 +1835,7 @@ dependencies = [
159 "checksum ct-logs 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1b4660f8b07a560a88c02d76286edb9f0d5d64e495d2b0f233186155aa51be1f"
160 "checksum derive_more 0.99.9 (registry+https://github.com/rust-lang/crates.io-index)" = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76"
161 "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90"
162- "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
163+ "checksum digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
164 "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901"
165 "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
166 "checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
167 @@ -1853,7 +1848,7 @@ dependencies = [
168 "checksum futures-backoff 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79f590345ee8cedf1f36068db74ca81c7e7bf753a3e59ea58b0826243a13971b"
169 "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4"
170 "checksum futures-timer 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a5cedfe9b6dc756220782cc1ba5bcb1fa091cdcba155e40d3556159c3db58043"
171- "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
172+ "checksum generic-array 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac746a5f3bbfdadd6106868134545e684693d54d9d44f6e9588a7d54af0bf980"
173 "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
174 "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
175 "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462"
176 @@ -1896,7 +1891,7 @@ dependencies = [
177 "checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
178 "checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
179 "checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
180- "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
181+ "checksum opaque-debug 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
182 "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
183 "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
184 "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
185 @@ -1940,7 +1935,7 @@ dependencies = [
186 "checksum serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25"
187 "checksum serde_test 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "33f96dff8c3744387b53404ea33e834073b0791dcc1ea9c85b805745f9324704"
188 "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0"
189- "checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
190+ "checksum sha2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
191 "checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
192 "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
193 "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
194 @@ -1989,6 +1984,7 @@ dependencies = [
195 "checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
196 "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
197 "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
198+ "checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
199 "checksum want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230"
200 "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
201 "checksum webpki 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f7e1cd7900a3a6b65a3e8780c51a3e6b59c0e2c55c6dc69578c288d69f7d082"
202 diff --git a/Cargo.toml b/Cargo.toml
203index 9e341ad..00e1393 100644
204--- a/Cargo.toml
205+++ b/Cargo.toml
206 @@ -21,7 +21,7 @@ chacha = "0.3"
207 derive_more = "0.99"
208 futures = "0.1"
209 futures-backoff = "0.1"
210- generic-array = "0.12"
211+ generic-array = "0.14"
212 hex = "0.3"
213 http = "0.1"
214 human-size = "0.4"
215 @@ -32,7 +32,7 @@ log = "0.4"
216 pretty_env_logger = "0.3"
217 serde = { version = "1", features = ["derive"] }
218 serde_json = "1"
219- sha2 = "0.8"
220+ sha2 = "0.9"
221 structopt = "0.2"
222 tokio = "0.1"
223 url = "1"
224 diff --git a/src/sha256.rs b/src/sha256.rs
225index 3572828..506651d 100644
226--- a/src/sha256.rs
227+++ b/src/sha256.rs
228 @@ -159,7 +159,7 @@ impl Serialize for Sha256 {
229 // Serialize as a hex string.
230 let mut hex = String::new();
231 self.0
232- .as_ref()
233+ .as_slice()
234 .write_hex(&mut hex)
235 .map_err(ser::Error::custom)?;
236 serializer.serialize_str(&hex)
237 @@ -301,12 +301,12 @@ where
238 self.len += bytes.as_ref().len() as u64;
239
240 // Continuously hash the bytes as we receive them.
241- self.hasher.input(bytes.as_ref());
242+ self.hasher.update(bytes.as_ref());
243
244 if self.len >= self.total {
245 // This is the last chunk in the stream. Verify that the
246 // digest matches.
247- let found = Sha256::from(self.hasher.result_reset());
248+ let found = Sha256::from(self.hasher.finalize_reset());
249
250 if found == self.expected {
251 Ok(Async::Ready(Some(bytes)))