OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/safe_browsing_db/v4_protocol_manager_util.h" | 5 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/hash.h" |
8 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
9 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
10 #include "base/sha1.h" | 11 #include "base/sha1.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
13 #include "crypto/sha2.h" | 14 #include "crypto/sha2.h" |
14 #include "net/base/escape.h" | 15 #include "net/base/escape.h" |
15 #include "net/base/ip_address.h" | 16 #include "net/base/ip_address.h" |
16 #include "net/http/http_request_headers.h" | 17 #include "net/http/http_request_headers.h" |
17 #include "url/url_util.h" | 18 #include "url/url_util.h" |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 573 |
573 const std::string hash = base::SHA1HashString(packed_ip); | 574 const std::string hash = base::SHA1HashString(packed_ip); |
574 DCHECK_EQ(20u, hash.size()); | 575 DCHECK_EQ(20u, hash.size()); |
575 hashed_encoded_ip->resize(hash.size() + 1); | 576 hashed_encoded_ip->resize(hash.size() + 1); |
576 hashed_encoded_ip->replace(0, hash.size(), hash); | 577 hashed_encoded_ip->replace(0, hash.size(), hash); |
577 (*hashed_encoded_ip)[hash.size()] = static_cast<unsigned char>(128); | 578 (*hashed_encoded_ip)[hash.size()] = static_cast<unsigned char>(128); |
578 return true; | 579 return true; |
579 } | 580 } |
580 | 581 |
581 } // namespace safe_browsing | 582 } // namespace safe_browsing |
OLD | NEW |