blob: 998cccba8d4fbc7a96fe2a1be90180854728298f [file] [log] [blame]
rvargas@google.com73eb5d02011-03-25 04:00:20 +09001// Copyright (c) 2011 The Chromium Authors. All rights reserved.
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +09002// 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_
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +09007
8#include <string>
9
darin@chromium.orge585bed2011-08-06 00:34:00 +090010#include "base/base_export.h"
rvargas@google.com73eb5d02011-03-25 04:00:20 +090011
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090012namespace base {
13
pkasting@chromium.orgbd6391d2011-09-29 06:15:27 +090014// These functions perform SHA-1 operations.
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090015
pkasting@chromium.orgbd6391d2011-09-29 06:15:27 +090016static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash.
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090017
18// Computes the SHA-1 hash of the input string |str| and returns the full
19// hash.
darin@chromium.orge585bed2011-08-06 00:34:00 +090020BASE_EXPORT std::string SHA1HashString(const std::string& str);
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090021
hans@chromium.org273df682011-03-14 06:17:20 +090022// Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash
pkasting@chromium.orgbd6391d2011-09-29 06:15:27 +090023// in |hash|. |hash| must be kSHA1Length bytes long.
darin@chromium.orge585bed2011-08-06 00:34:00 +090024BASE_EXPORT void SHA1HashBytes(const unsigned char* data, size_t len,
25 unsigned char* hash);
hans@chromium.org273df682011-03-14 06:17:20 +090026
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090027} // namespace base
28
29#endif // BASE_SHA1_H_