OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #include "blimp/common/blob_cache/sha1_util.h" |
| 6 |
| 7 #include "base/sha1.h" |
| 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" |
| 10 |
| 11 namespace blimp { |
| 12 |
| 13 std::vector<unsigned char> ToSHA1HashBytes(const void* data, size_t data_size) { |
| 14 std::vector<unsigned char> sha1_hash(base::kSHA1Length); |
| 15 base::SHA1HashBytes(static_cast<const unsigned char*>(data), data_size, |
| 16 sha1_hash.data()); |
| 17 |
| 18 return sha1_hash; |
| 19 } |
| 20 |
| 21 const std::string ToSHA1HexString(const void* data) { |
| 22 return base::ToLowerASCII(base::HexEncode(data, base::kSHA1Length)); |
| 23 } |
| 24 |
| 25 } // namespace blimp |
OLD | NEW |