Chromium Code Reviews

Side by Side Diff: crypto/sha2_unittest.cc

Issue 1261333004: Add support for Flash Player Component updates on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to fix merge conflicts Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 "crypto/sha2.h" 5 #include "crypto/sha2.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 TEST(Sha256Test, Test1) { 10 TEST(Sha256Test, Test1) {
(...skipping 80 matching lines...)
91 crypto::SHA256HashString(input3, output3, sizeof(output3)); 91 crypto::SHA256HashString(input3, output3, sizeof(output3));
92 for (size_t i = 0; i < crypto::kSHA256Length; i++) 92 for (size_t i = 0; i < crypto::kSHA256Length; i++)
93 EXPECT_EQ(expected3[i], static_cast<int>(output3[i])); 93 EXPECT_EQ(expected3[i], static_cast<int>(output3[i]));
94 94
95 uint8 output_truncated3[12]; 95 uint8 output_truncated3[12];
96 crypto::SHA256HashString(input3, 96 crypto::SHA256HashString(input3,
97 output_truncated3, sizeof(output_truncated3)); 97 output_truncated3, sizeof(output_truncated3));
98 for (size_t i = 0; i < sizeof(output_truncated3); i++) 98 for (size_t i = 0; i < sizeof(output_truncated3); i++)
99 EXPECT_EQ(expected3[i], static_cast<int>(output_truncated3[i])); 99 EXPECT_EQ(expected3[i], static_cast<int>(output_truncated3[i]));
100 } 100 }
101
102 TEST(Sha256Test, Test4) {
103 const uint8_t input4[] = {
104 0x47, 0x65, 0x74, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65,
105 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x6f, 0x63, 0x6b,
106 0x2c, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x6f, 0x6c, 0x6c, 0x20,
107 0x74, 0x68, 0x65, 0x20, 0x62, 0x6f, 0x6e, 0x65, 0x73, 0x21, 0x0a};
108 const uint8_t expected4[] = {0x9f, 0xbe, 0x2b, 0x07, 0x76, 0x55, 0x14, 0xc9,
109 0x50, 0xe1, 0x16, 0xee, 0xcc, 0x2d, 0x89, 0x2a,
110 0x5a, 0xfd, 0xaa, 0xae, 0x73, 0x54, 0xad, 0xb6,
111 0x12, 0x31, 0x7e, 0xd0, 0xb4, 0x67, 0x79, 0x17};
112
113 uint8_t output4[crypto::kSHA256Length];
114 crypto::SHA256HashBytes(input4, sizeof(input4), output4, sizeof(output4));
115 for (size_t i = 0; i < sizeof(output4); i++)
116 EXPECT_EQ(expected4[i], output4[i]);
117 }
OLDNEW
« chrome/common/component_flash_hint_file_linux.cc ('K') | « crypto/sha2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine