| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 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 | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #include "crypto/secure_hash.h" | 
|  | 6 | 
|  | 7 #include "base/basictypes.h" | 
|  | 8 #include "base/memory/scoped_ptr.h" | 
|  | 9 #include "crypto/sha2.h" | 
|  | 10 #include "testing/gtest/include/gtest/gtest.h" | 
|  | 11 | 
|  | 12 TEST(SecureHashTest, TestUpdate) { | 
|  | 13   // Example B.3 from FIPS 180-2: long message. | 
|  | 14   std::string input3(500000, 'a');  // 'a' repeated half a million times | 
|  | 15   int expected3[] = { 0xcd, 0xc7, 0x6e, 0x5c, | 
|  | 16                       0x99, 0x14, 0xfb, 0x92, | 
|  | 17                       0x81, 0xa1, 0xc7, 0xe2, | 
|  | 18                       0x84, 0xd7, 0x3e, 0x67, | 
|  | 19                       0xf1, 0x80, 0x9a, 0x48, | 
|  | 20                       0xa4, 0x97, 0x20, 0x0e, | 
|  | 21                       0x04, 0x6d, 0x39, 0xcc, | 
|  | 22                       0xc7, 0x11, 0x2c, 0xd0 }; | 
|  | 23 | 
|  | 24   uint8 output3[crypto::SHA256_LENGTH]; | 
|  | 25 | 
|  | 26   scoped_ptr<crypto::SecureHash> ctx(crypto::SecureHash::Create( | 
|  | 27       crypto::SecureHash::SHA256)); | 
|  | 28   ctx->Update(input3.data(), input3.size()); | 
|  | 29   ctx->Update(input3.data(), input3.size()); | 
|  | 30 | 
|  | 31   ctx->Finish(output3, sizeof(output3)); | 
|  | 32   for (size_t i = 0; i < crypto::SHA256_LENGTH; i++) | 
|  | 33     EXPECT_EQ(expected3[i], static_cast<int>(output3[i])); | 
|  | 34 } | 
| OLD | NEW | 
|---|