Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * SHA-1 in C | 2 * SHA-1 in C |
| 3 * By Steve Reid <sreid@sea-to-sky.net> | 3 * By Steve Reid <sreid@sea-to-sky.net> |
| 4 * 100% Public Domain | 4 * 100% Public Domain |
| 5 * | 5 * |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 // Ported to C++, Google style, under namespace rtc and uses basictypes.h | 8 // Ported to C++, Google style, under namespace rtc and uses basictypes.h |
| 9 | 9 |
| 10 #ifndef WEBRTC_BASE_SHA1_H_ | 10 #ifndef WEBRTC_BASE_SHA1_H_ |
| 11 #define WEBRTC_BASE_SHA1_H_ | 11 #define WEBRTC_BASE_SHA1_H_ |
| 12 | 12 |
| 13 #include "webrtc/base/basictypes.h" | 13 #include "webrtc/base/basictypes.h" |
|
Henrik Grunell WebRTC
2015/10/05 14:10:42
We shouldn't need this now, right? Update comment
pbos-webrtc
2015/10/06 09:14:59
Adding stdint.h/stdlib.h for the types and updatin
| |
| 14 | 14 |
| 15 namespace rtc { | 15 namespace rtc { |
| 16 | 16 |
| 17 struct SHA1_CTX { | 17 struct SHA1_CTX { |
| 18 uint32 state[5]; | 18 uint32_t state[5]; |
| 19 // TODO: Change bit count to uint64. | 19 // TODO: Change bit count to uint64_t. |
| 20 uint32 count[2]; // Bit count of input. | 20 uint32_t count[2]; // Bit count of input. |
| 21 uint8 buffer[64]; | 21 uint8_t buffer[64]; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 #define SHA1_DIGEST_SIZE 20 | 24 #define SHA1_DIGEST_SIZE 20 |
| 25 | 25 |
| 26 void SHA1Init(SHA1_CTX* context); | 26 void SHA1Init(SHA1_CTX* context); |
| 27 void SHA1Update(SHA1_CTX* context, const uint8* data, size_t len); | 27 void SHA1Update(SHA1_CTX* context, const uint8_t* data, size_t len); |
| 28 void SHA1Final(SHA1_CTX* context, uint8 digest[SHA1_DIGEST_SIZE]); | 28 void SHA1Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]); |
| 29 | 29 |
| 30 #endif // WEBRTC_BASE_SHA1_H_ | 30 #endif // WEBRTC_BASE_SHA1_H_ |
| 31 | 31 |
| 32 } // namespace rtc | 32 } // namespace rtc |
| OLD | NEW |