[go: nahoru, domu]

blob: 902e3013318d501a7a7df6983ef75d3661d3e419 [file] [log] [blame]
rvargas@google.comf5661ca2011-03-24 19:00:201// Copyright (c) 2011 The Chromium Authors. All rights reserved.
jhawkins@chromium.orgc2ad1e32009-11-04 19:29:582// 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.orgc2ad1e32009-11-04 19:29:587
avi9b6f42932015-12-26 22:15:148#include <stddef.h>
9
Henrik Grunellfc4ffc72017-11-30 11:56:4410#include <string>
11
darin@chromium.org0bea7252011-08-05 15:34:0012#include "base/base_export.h"
rvargas@google.comf5661ca2011-03-24 19:00:2013
jhawkins@chromium.orgc2ad1e32009-11-04 19:29:5814namespace base {
15
pkasting@chromium.orgb13b9bd2011-09-28 21:15:2716// These functions perform SHA-1 operations.
jhawkins@chromium.orgc2ad1e32009-11-04 19:29:5817
pkasting@chromium.orgb13b9bd2011-09-28 21:15:2718static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash.
jhawkins@chromium.orgc2ad1e32009-11-04 19:29:5819
20// Computes the SHA-1 hash of the input string |str| and returns the full
21// hash.
Henrik Grunellfc4ffc72017-11-30 11:56:4422BASE_EXPORT std::string SHA1HashString(const std::string& str);
jhawkins@chromium.orgc2ad1e32009-11-04 19:29:5823
hans@chromium.org5035f682011-03-13 21:17:2024// Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash
pkasting@chromium.orgb13b9bd2011-09-28 21:15:2725// in |hash|. |hash| must be kSHA1Length bytes long.
darin@chromium.org0bea7252011-08-05 15:34:0026BASE_EXPORT void SHA1HashBytes(const unsigned char* data, size_t len,
27 unsigned char* hash);
hans@chromium.org5035f682011-03-13 21:17:2028
jhawkins@chromium.orgc2ad1e32009-11-04 19:29:5829} // namespace base
30
31#endif // BASE_SHA1_H_