| 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef ANGLEBASE_SHA1_H_ |
| 6 | #define ANGLEBASE_SHA1_H_ |
| 7 | |
| 8 | #include <stddef.h> |
| 9 | |
| 10 | #include <string> |
| 11 | |
| 12 | #include "anglebase/base_export.h" |
| 13 | |
| 14 | namespace angle |
| 15 | { |
| 16 | |
| 17 | namespace base |
| 18 | { |
| 19 | |
| 20 | // These functions perform SHA-1 operations. |
| 21 | |
| 22 | static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash. |
| 23 | |
| 24 | // Computes the SHA-1 hash of the input string |str| and returns the full |
| 25 | // hash. |
| 26 | ANGLEBASE_EXPORT std::string SHA1HashString(const std::string &str); |
| 27 | |
| 28 | // Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash |
| 29 | // in |hash|. |hash| must be kSHA1Length bytes long. |
| 30 | ANGLEBASE_EXPORT void SHA1HashBytes(const unsigned char *data, size_t len, unsigned char *hash); |
| 31 | |
| 32 | } // namespace base |
| 33 | |
| 34 | } // namespace angle |
| 35 | |
| 36 | #endif // ANGLEBASE_SHA1_H_ |
| 37 | |