Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: base/sha1_unittest.cc

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/sha1_portable.cc ('k') | base/strings/string_number_conversions_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/sha1.h" 5 #include "base/sha1.h"
6 6
7 #include <stddef.h>
8
7 #include <string> 9 #include <string>
8 10
9 #include "base/basictypes.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 TEST(SHA1Test, Test1) { 13 TEST(SHA1Test, Test1) {
13 // Example A.1 from FIPS 180-2: one-block message. 14 // Example A.1 from FIPS 180-2: one-block message.
14 std::string input = "abc"; 15 std::string input = "abc";
15 16
16 int expected[] = { 0xa9, 0x99, 0x3e, 0x36, 17 int expected[] = { 0xa9, 0x99, 0x3e, 0x36,
17 0x47, 0x06, 0x81, 0x6a, 18 0x47, 0x06, 0x81, 0x6a,
18 0xba, 0x3e, 0x25, 0x71, 19 0xba, 0x3e, 0x25, 0x71,
19 0x78, 0x50, 0xc2, 0x6c, 20 0x78, 0x50, 0xc2, 0x6c,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 0xd4, 0xc4, 0xda, 0xa4, 100 0xd4, 0xc4, 0xda, 0xa4,
100 0xf6, 0x1e, 0xeb, 0x2b, 101 0xf6, 0x1e, 0xeb, 0x2b,
101 0xdb, 0xad, 0x27, 0x31, 102 0xdb, 0xad, 0x27, 0x31,
102 0x65, 0x34, 0x01, 0x6f }; 103 0x65, 0x34, 0x01, 0x6f };
103 104
104 base::SHA1HashBytes(reinterpret_cast<const unsigned char*>(input.c_str()), 105 base::SHA1HashBytes(reinterpret_cast<const unsigned char*>(input.c_str()),
105 input.length(), output); 106 input.length(), output);
106 for (size_t i = 0; i < base::kSHA1Length; i++) 107 for (size_t i = 0; i < base::kSHA1Length; i++)
107 EXPECT_EQ(expected[i], output[i]); 108 EXPECT_EQ(expected[i], output[i]);
108 } 109 }
OLDNEW
« no previous file with comments | « base/sha1_portable.cc ('k') | base/strings/string_number_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698