blob: af1fbe10f8c5e829a32d7e718ae04d1fe7881e6a [file] [log] [blame] [edit]
// Copyright 2025 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <variant>
#include <vector>
#include "dawn/common/Sha3.h"
#include "gtest/gtest.h"
namespace dawn {
namespace {
// Below test vectors are taken from
// https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
// Check that the internal Keccak function computes the correct update for the state.
// The test vectors are taken from intermediate results in
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-384_1600.pdf
TEST(Sha3, CheckKeccak) {
// Initial state and the end of page 2.
Sha3State initial = {
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
0x0000000000000000,
};
// State after one round of Keccak page 38.
Sha3State expected = {
0x160a71930ca2a8a3, 0x51ddb3b2c251d927, 0xdc9aa0e4bcc6ad64, 0xf8a14407bd495cd1,
0xf17b866f4d85efd0, 0x82d81704476a121c, 0x7cfa31f915062efa, 0x247ec6d41845f643,
0x1dc24a64defcf173, 0xdcfed5e4a19d5574, 0xbcae93fcba107740, 0x65c3c92d3e365e0c,
0x368cad882027066c, 0xea7e1cd53bf20792, 0x0daa532dce42e107, 0x2cb333822af5990b,
0x8b2bb75c6d627045, 0x4f550b11db349feb, 0x8bd8bdb493854b0c, 0x5386b7c92346dcc6,
0xcc3f58bf9c237342, 0xb3658927a749b560, 0x294fd2abede42c19, 0xb3fb1448aef7d65c,
0x644f5649d63f5404,
};
Sha3State transformed = KeccakForTesting(initial);
for (size_t i = 0; i < transformed.size(); i++) {
EXPECT_EQ(expected[i], transformed[i]);
}
}
template <size_t N>
void ExpectOutput(const std::array<uint8_t, N>& actual, const std::array<uint8_t, N>& expected) {
for (size_t i = 0; i < N; i++) {
EXPECT_EQ(actual[i], expected[i]);
}
}
// Check that the correct values are computed in all by all the hash functions on the 1600 bit test
// vectors for each SHA3 version. (we don't use the other ones because they are not byte aligned).
TEST(Sha3, AllSizesOn1600BitTestVector) {
std::array<uint64_t, 25> message = {
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3, 0xa3a3a3a3a3a3a3a3,
0xa3a3a3a3a3a3a3a3,
};
Sha3_224::Output sha224Expected = {0x93, 0x76, 0x81, 0x6A, 0xBA, 0x50, 0x3F, 0x72, 0xF9, 0x6C,
0xE7, 0xEB, 0x65, 0xAC, 0x09, 0x5D, 0xEE, 0xE3, 0xBE, 0x4B,
0xF9, 0xBB, 0xC2, 0xA1, 0xCB, 0x7E, 0x11, 0xE0};
Sha3_224::Output sha224Actual = Sha3_224::Hash(&message, sizeof(message));
ExpectOutput(sha224Actual, sha224Expected);
Sha3_256::Output sha256Expected = {0x79, 0xF3, 0x8A, 0xDE, 0xC5, 0xC2, 0x03, 0x07,
0xA9, 0x8E, 0xF7, 0x6E, 0x83, 0x24, 0xAF, 0xBF,
0xD4, 0x6C, 0xFD, 0x81, 0xB2, 0x2E, 0x39, 0x73,
0xC6, 0x5F, 0xA1, 0xBD, 0x9D, 0xE3, 0x17, 0x87};
Sha3_256::Output sha256Actual = Sha3_256::Hash(&message, sizeof(message));
ExpectOutput(sha256Actual, sha256Expected);
Sha3_384::Output sha384Expected = {0x18, 0x81, 0xDE, 0x2C, 0xA7, 0xE4, 0x1E, 0xF9, 0x5D, 0xC4,
0x73, 0x2B, 0x8F, 0x5F, 0x00, 0x2B, 0x18, 0x9C, 0xC1, 0xE4,
0x2B, 0x74, 0x16, 0x8E, 0xD1, 0x73, 0x26, 0x49, 0xCE, 0x1D,
0xBC, 0xDD, 0x76, 0x19, 0x7A, 0x31, 0xFD, 0x55, 0xEE, 0x98,
0x9F, 0x2D, 0x70, 0x50, 0xDD, 0x47, 0x3E, 0x8F};
Sha3_384::Output sha384Actual = Sha3_384::Hash(&message, sizeof(message));
ExpectOutput(sha384Actual, sha384Expected);
Sha3_512::Output sha512Expected = {
0xE7, 0x6D, 0xFA, 0xD2, 0x20, 0x84, 0xA8, 0xB1, 0x46, 0x7F, 0xCF, 0x2F, 0xFA,
0x58, 0x36, 0x1B, 0xEC, 0x76, 0x28, 0xED, 0xF5, 0xF3, 0xFD, 0xC0, 0xE4, 0x80,
0x5D, 0xC4, 0x8C, 0xAE, 0xEC, 0xA8, 0x1B, 0x7C, 0x13, 0xC3, 0x0A, 0xDF, 0x52,
0xA3, 0x65, 0x95, 0x84, 0x73, 0x9A, 0x2D, 0xF4, 0x6B, 0xE5, 0x89, 0xC5, 0x1C,
0xA1, 0xA4, 0xA8, 0x41, 0x6D, 0xF6, 0x54, 0x5A, 0x1C, 0xE8, 0xBA, 0x00};
Sha3_512::Output sha512Actual = Sha3_512::Hash(&message, sizeof(message));
ExpectOutput(sha512Actual, sha512Expected);
}
// Check that the correct values are computed by various non-1600 sizes for one of the variants
TEST(Sha3, VariousMessageSizes) {
// Test what happens with no data provided.
{
Sha3_224::Output sha224Expected = {
0x6B, 0x4E, 0x03, 0x42, 0x36, 0x67, 0xDB, 0xB7, 0x3B, 0x6E, 0x15, 0x45, 0x4F, 0x0E,
0xB1, 0xAB, 0xD4, 0x59, 0x7F, 0x9A, 0x1B, 0x07, 0x8E, 0x3F, 0x5B, 0x5A, 0x6B, 0xC7};
Sha3_224::Output sha224Actual = Sha3_224::Hash(nullptr, 0);
ExpectOutput(sha224Actual, sha224Expected);
}
// Test any amount of data that doesn't require any Keccak other than the final one.
{
std::array<char, 42> data;
data.fill('a');
Sha3_224::Output sha224Expected = {
0xF4, 0xFB, 0x9A, 0x8F, 0xA2, 0x04, 0x0F, 0x8C, 0x72, 0xC2, 0x2D, 0x6B, 0x26, 0xEE,
0xE5, 0xA9, 0xF2, 0x2F, 0xC4, 0x9B, 0x86, 0x01, 0xC6, 0xCD, 0xAB, 0xE2, 0x3E, 0x0D};
Sha3_224::Output sha224Actual = Sha3_224::Hash(&data, sizeof(data));
ExpectOutput(sha224Actual, sha224Expected);
}
// Test a "long" message that requires many internal Keccaks
{
std::array<char, 4000> data;
data.fill('a');
Sha3_224::Output sha224Expected = {
0xB5, 0xBF, 0x09, 0x7A, 0x65, 0xB3, 0xC9, 0x42, 0x72, 0x6E, 0x16, 0x77, 0xD8, 0xEE,
0x5A, 0x59, 0x39, 0x6F, 0xD2, 0xEB, 0xBF, 0xB4, 0xCB, 0x2E, 0x9F, 0xBA, 0x2F, 0x67};
Sha3_224::Output sha224Actual = Sha3_224::Hash(&data, sizeof(data));
ExpectOutput(sha224Actual, sha224Expected);
}
}
// Check that using Update at any byte boundary produces the same result
TEST(Sha3, UpdateAnyByteBoundary) {
// 500 bytes need at least three different Keccak transforms so we should cover all the special
// values of the internal insertion offset in Sha3.
std::array<char, 500> data;
data.fill('a');
Sha3_224::Output sha224Expected = {0xB3, 0x36, 0x37, 0x5B, 0xF8, 0xE6, 0x2A, 0x2F, 0x34, 0xF8,
0xC4, 0xE3, 0xF9, 0xFD, 0xD5, 0x34, 0x1E, 0x85, 0xB0, 0x23,
0x49, 0xD9, 0x18, 0x73, 0xC5, 0x9D, 0x70, 0x36};
for (size_t offset = 0; offset < sizeof(data); offset++) {
Sha3_224 sha;
sha.Update(&data[0], offset);
sha.Update(&data[offset], sizeof(data) - offset);
Sha3_224::Output sha224Actual = sha.Finalize();
ExpectOutput(sha224Actual, sha224Expected);
}
}
enum class HasherType {
Sha3_224,
Sha3_256,
Sha3_384,
Sha3_512,
};
// Helper class to provide uniform interface for all Sha3 variants.
class Sha3Proxy {
public:
explicit Sha3Proxy(HasherType type) : mType(type) {
switch (type) {
case HasherType::Sha3_224:
mHasher = Sha3_224();
break;
case HasherType::Sha3_256:
mHasher = Sha3_256();
break;
case HasherType::Sha3_384:
mHasher = Sha3_384();
break;
case HasherType::Sha3_512:
mHasher = Sha3_512();
break;
default:
// Unreachable
[]() { ASSERT_TRUE(false); }();
break;
}
}
size_t OutputByteSize() const {
switch (mType) {
case HasherType::Sha3_224:
return 224 / 8;
case HasherType::Sha3_256:
return 256 / 8;
case HasherType::Sha3_384:
return 384 / 8;
case HasherType::Sha3_512:
return 512 / 8;
default:
// Unreachable
[]() { ASSERT_TRUE(false); }();
break;
}
}
std::vector<uint8_t> Hash(const void* data, size_t size) {
switch (mType) {
case HasherType::Sha3_224:
return HashImpl<224>(data, size);
case HasherType::Sha3_256:
return HashImpl<256>(data, size);
case HasherType::Sha3_384:
return HashImpl<384>(data, size);
case HasherType::Sha3_512:
return HashImpl<512>(data, size);
default:
// Unreachable
[]() { ASSERT_TRUE(false); }();
break;
}
}
void Update(const void* data, size_t size) {
switch (mType) {
case HasherType::Sha3_224:
return UpdateImpl<224>(data, size);
case HasherType::Sha3_256:
return UpdateImpl<256>(data, size);
case HasherType::Sha3_384:
return UpdateImpl<384>(data, size);
case HasherType::Sha3_512:
return UpdateImpl<512>(data, size);
default:
// Unreachable
ASSERT_TRUE(false);
break;
}
}
std::vector<uint8_t> Finalize() {
switch (mType) {
case HasherType::Sha3_224:
return FinalizeImpl<224>();
case HasherType::Sha3_256:
return FinalizeImpl<256>();
case HasherType::Sha3_384:
return FinalizeImpl<384>();
case HasherType::Sha3_512:
return FinalizeImpl<512>();
default:
// Unreachable
[]() { ASSERT_TRUE(false); }();
break;
}
}
private:
const HasherType mType;
std::variant<Sha3_224, Sha3_256, Sha3_384, Sha3_512> mHasher;
template <size_t N>
std::vector<uint8_t> HashImpl(const void* data, size_t size) {
auto& hasher = std::get<Sha3<N>>(mHasher);
auto resultArray = hasher.Hash(data, size);
std::vector<uint8_t> resultVector;
static_assert(resultArray.size() == N / 8);
resultVector.reserve(N / 8);
for (size_t i = 0; i < N / 8; i++) {
resultVector.push_back(resultArray[i]);
}
return resultVector;
}
template <size_t N>
void UpdateImpl(const void* data, size_t size) {
auto& hasher = std::get<Sha3<N>>(mHasher);
hasher.Update(data, size);
}
template <size_t N>
std::vector<uint8_t> FinalizeImpl() {
auto& hasher = std::get<Sha3<N>>(mHasher);
auto resultArray = hasher.Finalize();
std::vector<uint8_t> resultVector;
static_assert(resultArray.size() == N / 8);
resultVector.reserve(N / 8);
for (size_t i = 0; i < N / 8; i++) {
resultVector.push_back(resultArray[i]);
}
return resultVector;
}
};
struct Sha3LongMessageTestingVector {
HasherType type;
const size_t inputByteSize;
const std::vector<uint8_t> input;
const std::initializer_list<uint8_t> expectedOutput;
};
using Sha3LongMessageTestingVectors = std::initializer_list<Sha3LongMessageTestingVector>;
// Below testing vectors are from FIPS 202 SHA-3 Hash Function Test Vectors for Hashing
// Byte-Oriented Messages, NIST CAVP.
// https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/Secure-Hashing
// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/sha3/sha-3bytetestvectors.zip
// These testing vectors are much longer than the byte rate of performing Keccak, and avoid using
// trivially repeating bytes pattern which might be unable to detect wrong input reading.
Sha3LongMessageTestingVectors longMessageTestingVectors{
// From SHA3_224LongMsg.rsp
Sha3LongMessageTestingVector{
HasherType::Sha3_224,
5792 / 8,
{0xa6, 0x3e, 0xbf, 0x8f, 0x97, 0xc6, 0x52, 0x92, 0x98, 0xe4, 0xd4, 0xb5, 0x73, 0xca, 0x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0x9c, 0x1d, 0x91, 0xbf, 0x45, 0x74, 0xd5, 0x53,
0xa9, 0x2a, 0x4a, 0x6c, 0x30, 0x5a, 0xb0, 0x9d, 0xb6, 0xbb, 0xef, 0xfd, 0x84, 0xc7, 0xaa,
0x70, 0x7f, 0x1c, 0x16, 0x28, 0xa0, 0x22, 0x0d, 0x6b, 0xa4, 0xee, 0x5e, 0x96, 0x05, 0x66,
0x68, 0x62, 0x28, 0xa6, 0xe7, 0x66, 0xd8, 0xa3, 0x0d, 0xdd, 0xf3, 0x0e, 0xd5, 0xaa, 0x63,
0x7c, 0x94, 0x99, 0x50, 0xc3, 0xd0, 0xe8, 0x94, 0xa7, 0x56, 0x06, 0x70, 0xb6, 0x87, 0x9a,
0x7d, 0x70, 0xf3, 0xc7, 0xe5, 0xab, 0x29, 0xae, 0xd2, 0x36, 0xcc, 0x35, 0x27, 0xbd, 0xea,
0x07, 0x6f, 0xec, 0x8a, 0xdd, 0x12, 0xd7, 0x84, 0xfb, 0xcf, 0x9a},
{0x68, 0xf6, 0x2c, 0x41, 0x8a, 0x6b, 0x97, 0x02, 0x6c, 0xc7, 0x0f,
0x6a, 0xbf, 0x84, 0x19, 0xb6, 0x71, 0xee, 0x37, 0x37, 0x09, 0xfa,
0x13, 0x07, 0x4e, 0x37, 0xbd, 0x39, 0xf0, 0xa5, 0x0f, 0xcb}},
// From SHA3_384LongMsg.rsp
{HasherType::Sha3_384,
6712 / 8,
{0x42, 0x26, 0x25, 0x15, 0xac, 0x21, 0xc5, 0xc2, 0x3e, 0xdf, 0x72, 0x49, 0x42, 0x50, 0xe8,
0xc5, 0x71, 0x16, 0xd6, 0x7c, 0x0c, 0x45, 0x8f, 0xc2, 0x28, 0x67, 0x02, 0x1a, 0x4a, 0xc4,
0xec, 0x9f, 0x33, 0xe0, 0x4c, 0xa2, 0xfd, 0x44, 0x18, 0x95, 0x67, 0x81, 0x2e, 0x27, 0x6e,
0x73, 0x8d, 0xb1, 0x1d, 0xc3, 0xc5,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 0x59, 0x5e, 0x5f, 0x9e, 0xc9,
0x80, 0xe3, 0x94, 0xa7, 0xea, 0xde, 0x3c, 0x22, 0x5d, 0x18, 0x10, 0x5f, 0xbb, 0x01, 0x90,
0x6e, 0x23, 0x46, 0x87, 0x7d, 0x5e, 0xa2, 0x8f, 0x4b, 0x7a, 0xf7, 0xd7, 0xe0, 0xb4, 0x9d,
0x24, 0x7c, 0x9c, 0xf9, 0x16, 0xcd, 0x73, 0x52, 0xad, 0x64, 0xd8, 0xe1, 0x0b, 0x6a},
{0x69, 0x4b, 0x79, 0x14, 0x8a, 0x8b, 0x6a, 0x32, 0x78, 0xb9, 0x08, 0x84,
0x67, 0xc5, 0xf6, 0x2e, 0x29, 0x52, 0x75, 0x25, 0x4c, 0x62, 0xec, 0xe9,
0xba, 0x35, 0x86, 0xdd, 0x09, 0xf4, 0x79, 0x1c, 0xea, 0xe4, 0x44, 0x59,
0x99, 0x19, 0x9f, 0x42, 0x1e, 0xb5, 0xad, 0x6d, 0x04, 0xff, 0xf5, 0x2e}},
// From SHA3_512LongMsg.rsp
{HasherType::Sha3_512,
7000 / 8,
{0x09, 0xab, 0x78, 0x27, 0x47, 0x14, 0x14, 0x0e, 0x9e, 0x25, 0xd8, 0x1c, 0xa9, 0xa1, 0xcb,
0x47, 0x59, 0x45, 0x09, 0x4f, 0x39, 0xfb, 0x22, 0x96, 0xf6, 0x51, 0xbd, 0x31, 0x1e, 0x29,
0x81, 0x3f, 0x28, 0xb2, 0x35, 0x79, 0xb5, 0x97, 0x25, 0x0b, 0x15, 0x76, 0xc8, 0xa3, 0x0d,
0x93, 0xa1, 0xc7, 0xd7, 0xce, 0x63, 0x6b, 0x6b, 0xd2, 0x58, 0xc3, 0xfd, 0x90, 0x03, 0x56,
0xc7, 0xec, 0x05, 0x54, 0x08, 0xb5, 0x3d, 0x29, 0x4d, 0xdb, 0x33, 0x52, 0xef, 0xdc, 0xb7,
0x6f, 0xdd, 0x80, 0xc5, 0x9a, 0x9b, 0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 0x3f, 0x81, 0xc7, 0x01, 0x9e,
0x99, 0x23, 0x44, 0x17, 0xa7, 0xcf, 0x01, 0xdb, 0xa9, 0x1d, 0x55, 0x65, 0xbf, 0x04, 0x6b,
0x00, 0x97, 0xc4, 0x95, 0x89, 0x28, 0xc9, 0x9b, 0x76, 0xa3, 0xd2, 0x53, 0x17, 0xa6, 0x52,
0x71, 0x1c, 0xb3, 0x16, 0xa1, 0x58, 0xe2, 0x29, 0xd3, 0xc4, 0xd2, 0xf5, 0xd6, 0xc7, 0xe5,
0xaa, 0x29, 0xb4, 0xad, 0xe4},
{0x2c, 0x11, 0x82, 0xee, 0xe0, 0xa9, 0x0b, 0x68, 0x6a, 0x14, 0xe5, 0xc7, 0xf7,
0xbd, 0x47, 0xf8, 0x9d, 0x44, 0xd5, 0x31, 0xa5, 0x3c, 0x84, 0xe8, 0x8c, 0x45,
0x9c, 0x14, 0x60, 0xac, 0x7d, 0x2c, 0xc7, 0x92, 0x2b, 0x7b, 0xe6, 0x72, 0x59,
0x6d, 0x55, 0x65, 0x4c, 0xb3, 0x88, 0xcf, 0x9b, 0x33, 0x00, 0xa9, 0xf3, 0x1f,
0x18, 0xfb, 0xb4, 0x5f, 0x89, 0xa7, 0xdb, 0xee, 0x27, 0xed, 0x46, 0x2d}},
};
void ExpectOutput(const std::vector<uint8_t>& actual,
const std::initializer_list<uint8_t>& expected) {
ASSERT_EQ(actual.size(), expected.size());
size_t i = 0;
for (auto expectedElem : expected) {
EXPECT_EQ(actual[i], expectedElem);
i++;
}
}
// Check that hashing the long non-trivial message produces the expected output
TEST(Sha3, LongMessage) {
for (const auto& test : longMessageTestingVectors) {
ASSERT_EQ(test.input.size(), test.inputByteSize);
Sha3Proxy sha3(test.type);
ASSERT_EQ(test.expectedOutput.size(), sha3.OutputByteSize());
auto result = sha3.Hash(test.input.data(), test.input.size());
ExpectOutput(result, test.expectedOutput);
}
}
// Check that using Update at any byte boundary produces the same result
TEST(Sha3, LongMessageUpdate) {
for (const auto& test : longMessageTestingVectors) {
ASSERT_EQ(test.input.size(), test.inputByteSize);
for (size_t offset = 0; offset <= test.inputByteSize; offset++) {
Sha3Proxy sha3(test.type);
ASSERT_EQ(test.expectedOutput.size(), sha3.OutputByteSize());
sha3.Update(test.input.data(), offset);
sha3.Update(test.input.data() + offset, test.inputByteSize - offset);
auto result = sha3.Finalize();
ExpectOutput(result, test.expectedOutput);
}
}
}
} // anonymous namespace
} // namespace dawn