Index: net/spdy/hpack_string_util.cc |
diff --git a/net/spdy/hpack_string_util.cc b/net/spdy/hpack_string_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a5619cb4f115890c7bb4d3a17e9d455a212901f3 |
--- /dev/null |
+++ b/net/spdy/hpack_string_util.cc |
@@ -0,0 +1,24 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/spdy/hpack_string_util.h" |
+ |
+#include "base/basictypes.h" |
+ |
+namespace net { |
+ |
+bool StringPiecesEqualConstantTime(base::StringPiece str1, |
+ base::StringPiece str2) { |
+ size_t size = str1.size(); |
+ if (str2.size() != size) |
+ return false; |
+ |
+ uint8 x = 0; |
+ for (size_t i = 0; i < size; ++i) { |
+ x |= str1[i] ^ str2[i]; |
+ } |
+ return x == 0; |
+} |
+ |
+} // namespace net |