blob: 998cccba8d4fbc7a96fe2a1be90180854728298f [file] [log] [blame]
James Robinson646469d2014-10-03 15:33:28 -07001// 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 BASE_SHA1_H_
6#define BASE_SHA1_H_
7
8#include <string>
9
10#include "base/base_export.h"
11
12namespace base {
13
14// These functions perform SHA-1 operations.
15
16static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash.
17
18// Computes the SHA-1 hash of the input string |str| and returns the full
19// hash.
20BASE_EXPORT std::string SHA1HashString(const std::string& str);
21
22// Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash
23// in |hash|. |hash| must be kSHA1Length bytes long.
24BASE_EXPORT void SHA1HashBytes(const unsigned char* data, size_t len,
25 unsigned char* hash);
26
27} // namespace base
28
29#endif // BASE_SHA1_H_