blob: 902e3013318d501a7a7df6983ef75d3661d3e419 [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
avia6a6a682015-12-27 07:15:14 +09008#include <stddef.h>
9
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090010#include <string>
11
darin@chromium.orge585bed2011-08-06 00:34:00 +090012#include "base/base_export.h"
rvargas@google.com73eb5d02011-03-25 04:00:20 +090013
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090014namespace base {
15
pkasting@chromium.orgbd6391d2011-09-29 06:15:27 +090016// These functions perform SHA-1 operations.
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090017
pkasting@chromium.orgbd6391d2011-09-29 06:15:27 +090018static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash.
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090019
20// Computes the SHA-1 hash of the input string |str| and returns the full
21// hash.
darin@chromium.orge585bed2011-08-06 00:34:00 +090022BASE_EXPORT std::string SHA1HashString(const std::string& str);
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090023
hans@chromium.org273df682011-03-14 06:17:20 +090024// Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash
pkasting@chromium.orgbd6391d2011-09-29 06:15:27 +090025// in |hash|. |hash| must be kSHA1Length bytes long.
darin@chromium.orge585bed2011-08-06 00:34:00 +090026BASE_EXPORT void SHA1HashBytes(const unsigned char* data, size_t len,
27 unsigned char* hash);
hans@chromium.org273df682011-03-14 06:17:20 +090028
jhawkins@chromium.orgf64907f2009-11-05 04:29:58 +090029} // namespace base
30
31#endif // BASE_SHA1_H_