OLD | NEW |
1 /////////////////////////////////////////////////////////////////////////////// | 1 /////////////////////////////////////////////////////////////////////////////// |
2 // | 2 // |
3 /// \file sha256.c | 3 /// \file sha256.c |
4 /// \brief SHA-256 | 4 /// \brief SHA-256 |
5 /// | 5 /// |
6 /// \todo Crypto++ has x86 ASM optimizations. They use SSE so if they | 6 /// \todo Crypto++ has x86 ASM optimizations. They use SSE so if they |
7 /// are imported to liblzma, SSE instructions need to be used | 7 /// are imported to liblzma, SSE instructions need to be used |
8 /// conditionally to keep the code working on older boxes. | 8 /// conditionally to keep the code working on older boxes. |
9 /// We could also support using some external libary for SHA-256. | |
10 // | 9 // |
11 // This code is based on the code found from 7-Zip, which has a modified | 10 // This code is based on the code found from 7-Zip, which has a modified |
12 // version of the SHA-256 found from Crypto++ <http://www.cryptopp.com/>. | 11 // version of the SHA-256 found from Crypto++ <http://www.cryptopp.com/>. |
13 // The code was modified a little to fit into liblzma. | 12 // The code was modified a little to fit into liblzma. |
14 // | 13 // |
15 // Authors: Kevin Springle | 14 // Authors: Kevin Springle |
16 // Wei Dai | 15 // Wei Dai |
17 // Igor Pavlov | 16 // Igor Pavlov |
18 // Lasse Collin | 17 // Lasse Collin |
19 // | 18 // |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 191 |
193 check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size); | 192 check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size); |
194 | 193 |
195 process(check); | 194 process(check); |
196 | 195 |
197 for (size_t i = 0; i < 8; ++i) | 196 for (size_t i = 0; i < 8; ++i) |
198 check->buffer.u32[i] = conv32be(check->state.sha256.state[i]); | 197 check->buffer.u32[i] = conv32be(check->state.sha256.state[i]); |
199 | 198 |
200 return; | 199 return; |
201 } | 200 } |
OLD | NEW |