Chromium Code Reviews| Index: base/sha1_portable.cc |
| diff --git a/base/sha1_portable.cc b/base/sha1_portable.cc |
| index cc05a5c91f0601ac0fbe651df7f76a3398fef862..bac86f947ba57873617d98265e8947d516dc56ef 100644 |
| --- a/base/sha1_portable.cc |
| +++ b/base/sha1_portable.cc |
| @@ -5,6 +5,7 @@ |
| #include "base/sha1.h" |
| #include "base/basictypes.h" |
| +#include <cstring> |
|
wtc
2011/03/11 18:46:15
1. Nit: I recommend including the C header <string
hans
2011/03/13 19:48:16
done
|
| namespace base { |
| @@ -203,4 +204,13 @@ std::string SHA1HashString(const std::string& str) { |
| return out; |
| } |
| +void SHA1HashBytes(const unsigned char* data, size_t len, |
| + unsigned char* hash_array) { |
| + SecureHashAlgorithm sha; |
| + sha.Update(data, len); |
| + sha.Final(); |
| + |
| + std::memcpy(hash_array, sha.Digest(), SecureHashAlgorithm::kDigestSizeBytes); |
| +} |
| + |
| } // namespace base |