tests/src/sha256.cpp (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
extern "C"
{
#include "tinycrypt/sha2.h"
}
#include "gtest/gtest.h"
#include <cstdint>
#include <cstring>
#include <cstddef>
TEST (TinyCrypT, empty_sha256)
{
uint8_t digest[32];
uint8_t reference[32] = {
0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4,
0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b,
0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55,
};
tct_sha256(NULL, 0, digest);
EXPECT_EQ (memcmp (digest, reference, 32), 0);
}
|