OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/signin/core/browser/signin_internals_util.h" | 5 #include "components/signin/core/browser/signin_internals_util.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 std::string GetTruncatedHash(const std::string& str) { | 61 std::string GetTruncatedHash(const std::string& str) { |
62 if (str.empty()) | 62 if (str.empty()) |
63 return str; | 63 return str; |
64 | 64 |
65 // Since each character in the hash string generates two hex charaters | 65 // Since each character in the hash string generates two hex charaters |
66 // we only need half as many charaters in |hash_val| as hex characters | 66 // we only need half as many charaters in |hash_val| as hex characters |
67 // returned. | 67 // returned. |
68 const int kTruncateSize = kTruncateTokenStringLength / 2; | 68 const int kTruncateSize = kTruncateTokenStringLength / 2; |
69 char hash_val[kTruncateSize]; | 69 char hash_val[kTruncateSize]; |
70 crypto::SHA256HashString(str, &hash_val[0], kTruncateSize); | 70 crypto::SHA256HashString(str, &hash_val[0], kTruncateSize); |
71 return base::StringToLowerASCII(base::HexEncode(&hash_val[0], kTruncateSize)); | 71 return base::ToLowerASCII(base::HexEncode(&hash_val[0], kTruncateSize)); |
72 } | 72 } |
73 | 73 |
74 } // namespace signin_internals_util | 74 } // namespace signin_internals_util |
OLD | NEW |