OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_SHA1_H_ | 5 #ifndef BASE_SHA1_H_ |
6 #define BASE_SHA1_H_ | 6 #define BASE_SHA1_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 | 12 |
13 // This function performs SHA-1 operations. | 13 // This function performs SHA-1 operations. |
14 | 14 |
15 enum { | 15 enum { |
16 SHA1_LENGTH = 20 // Length in bytes of a SHA-1 hash. | 16 SHA1_LENGTH = 20 // Length in bytes of a SHA-1 hash. |
17 }; | 17 }; |
18 | 18 |
19 // Computes the SHA-1 hash of the input string |str| and returns the full | 19 // Computes the SHA-1 hash of the input string |str| and returns the full |
20 // hash. | 20 // hash. |
21 std::string SHA1HashString(const std::string& str); | 21 std::string SHA1HashString(const std::string& str); |
22 | 22 |
23 // Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash | |
24 // in |hash_array|. | |
25 void SHA1HashBytes(const unsigned char* data, size_t len, | |
26 unsigned char* hash_array); | |
wtc
2011/03/11 18:46:15
Nit: |hash_array| can be shortened to |hash|.
Ple
hans
2011/03/13 19:48:16
done
| |
27 | |
23 } // namespace base | 28 } // namespace base |
24 | 29 |
25 #endif // BASE_SHA1_H_ | 30 #endif // BASE_SHA1_H_ |
OLD | NEW |