OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "net/base/hash_value.h" | 5 #include "net/base/hash_value.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/string_split.h" | |
11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/strings/string_split.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // CompareSHA1Hashes is a helper function for using bsearch() with an array of | 17 // CompareSHA1Hashes is a helper function for using bsearch() with an array of |
18 // SHA1 hashes. | 18 // SHA1 hashes. |
19 int CompareSHA1Hashes(const void* a, const void* b) { | 19 int CompareSHA1Hashes(const void* a, const void* b) { |
20 return memcmp(a, b, base::kSHA1Length); | 20 return memcmp(a, b, base::kSHA1Length); |
21 } | 21 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bool IsSHA1HashInSortedArray(const SHA1HashValue& hash, | 114 bool IsSHA1HashInSortedArray(const SHA1HashValue& hash, |
115 const uint8* array, | 115 const uint8* array, |
116 size_t array_byte_len) { | 116 size_t array_byte_len) { |
117 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); | 117 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); |
118 const size_t arraylen = array_byte_len / base::kSHA1Length; | 118 const size_t arraylen = array_byte_len / base::kSHA1Length; |
119 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, | 119 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, |
120 CompareSHA1Hashes); | 120 CompareSHA1Hashes); |
121 } | 121 } |
122 | 122 |
123 } // namespace net | 123 } // namespace net |
OLD | NEW |