Remove link_chrome_on_windows GN flag.
[chromium-blink-merge.git] / crypto / sha2.cc
blob6f362379618f108fefad4f4394b6c4a3d6a54a85
1 // Copyright (c) 2012 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.
5 #include "crypto/sha2.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h"
9 #include "crypto/secure_hash.h"
11 namespace crypto {
13 void SHA256HashString(const base::StringPiece& str, void* output, size_t len) {
14 scoped_ptr<SecureHash> ctx(SecureHash::Create(SecureHash::SHA256));
15 ctx->Update(str.data(), str.length());
16 ctx->Finish(output, len);
19 std::string SHA256HashString(const base::StringPiece& str) {
20 std::string output(kSHA256Length, 0);
21 SHA256HashString(str, string_as_array(&output), output.size());
22 return output;
25 } // namespace crypto