OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/spdy/hpack_string_util.h" | |
6 | |
7 #include "base/basictypes.h" | |
8 | |
9 namespace net { | |
10 | |
11 bool StringPiecesEqualConstantTime(base::StringPiece str1, | |
12 base::StringPiece str2) { | |
13 size_t size = str1.size(); | |
14 if (str2.size() != size) | |
15 return false; | |
16 | |
17 uint8 x = 0; | |
18 for (size_t i = 0; i < size; ++i) { | |
19 x |= str1[i] ^ str2[i]; | |
20 } | |
21 return x == 0; | |
22 } | |
23 | |
24 } // namespace net | |
OLD | NEW |