Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: crypto/sha1.h

Issue 2080753002: crypto: Add BoringSSL accelerated version of SHA-1 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/secure_hash.cc ('k') | crypto/sha1.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/sha1.h
diff --git a/crypto/sha1.h b/crypto/sha1.h
new file mode 100644
index 0000000000000000000000000000000000000000..a8251246fb8c315513fd8ae93534103f8680543c
--- /dev/null
+++ b/crypto/sha1.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CRYPTO_SHA1_H_
+#define CRYPTO_SHA1_H_
+
+#include <stddef.h>
+
+#include <string>
+
+#include "base/strings/string_piece.h"
+#include "crypto/crypto_export.h"
+
+namespace crypto {
+
+// These functions perform SHA-1 operations.
+
+static const size_t kSHA1Length = 20; // Length in bytes of a SHA-256 hash.
+
+// Computes the SHA-1 hash of the input string 'str' and stores the first
+// 'len' bytes of the hash in the output buffer 'output'. If 'len' > 32,
+// only 32 bytes (the full hash) are stored in the 'output' buffer.
+CRYPTO_EXPORT void SHA1HashString(const base::StringPiece& str,
+ void* output,
+ size_t len);
+
+// Convenience version of the above that returns the result in a 32-byte
+// string.
+CRYPTO_EXPORT std::string SHA1HashString(const base::StringPiece& str);
+
+} // namespace crypto
+
+#endif // CRYPTO_SHA1_H_
« no previous file with comments | « crypto/secure_hash.cc ('k') | crypto/sha1.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698