Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove keccakf800() #209

Merged
merged 1 commit into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions include/ethash/keccak.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@
extern "C" {
#endif

/**
* The Keccak-f[800] function.
*
* The implementation of the Keccak-f function with 800-bit width of the permutation (b).
* The size of the state is also 800 bit what gives 25 32-bit words.
*
* @param state The state of 25 32-bit words on which the permutation is to be performed.
*/
void ethash_keccakf800(uint32_t state[25]) noexcept;

union ethash_hash256 ethash_keccak256(const uint8_t* data, size_t size) noexcept;
union ethash_hash256 ethash_keccak256_32(const uint8_t data[32]) noexcept;
union ethash_hash512 ethash_keccak512(const uint8_t* data, size_t size) noexcept;
Expand Down
1 change: 0 additions & 1 deletion lib/keccak/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ target_sources(keccak PRIVATE
${include_dir}/ethash/keccak.h
${include_dir}/ethash/keccak.hpp
keccak.c
keccakf800.c
)

install(
Expand Down
230 changes: 0 additions & 230 deletions lib/keccak/keccakf800.c

This file was deleted.

12 changes: 0 additions & 12 deletions test/benchmarks/keccak_benchmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ void fake_keccakf1600(uint64_t* state) noexcept
(void)state;
}

static void keccakf800(benchmark::State& state)
{
uint32_t keccak_state[25] = {};

for (auto _ : state)
{
ethash_keccakf800(keccak_state);
benchmark::DoNotOptimize(keccak_state);
}
}
BENCHMARK(keccakf800);


static void keccak256(benchmark::State& state)
{
Expand Down
26 changes: 0 additions & 26 deletions test/unittests/test_keccak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,32 +247,6 @@ TEST(keccak, hpp_aliases)
EXPECT_EQ(keccak512_64(data).word64s[1], ethash_keccak512_64(data).word64s[1]);
}

TEST(keccak, f800)
{
// Test vectors from
// https://github.com/XKCP/XKCP/blob/master/tests/TestVectors/KeccakF-800-IntermediateValues.txt.

uint32_t state[25] = {};

const uint32_t expected_state_0[] = {0xE531D45D, 0xF404C6FB, 0x23A0BF99, 0xF1F8452F, 0x51FFD042,
0xE539F578, 0xF00B80A7, 0xAF973664, 0xBF5AF34C, 0x227A2424, 0x88172715, 0x9F685884,
0xB15CD054, 0x1BF4FC0E, 0x6166FA91, 0x1A9E599A, 0xA3970A1F, 0xAB659687, 0xAFAB8D68,
0xE74B1015, 0x34001A98, 0x4119EFF3, 0x930A0E76, 0x87B28070, 0x11EFE996};

ethash_keccakf800(state);
for (size_t i = 0; i < 25; ++i)
EXPECT_EQ(state[i], expected_state_0[i]);

const uint32_t expected_state_1[] = {0x75BF2D0D, 0x9B610E89, 0xC826AF40, 0x64CD84AB, 0xF905BDD6,
0xBC832835, 0x5F8001B9, 0x15662CCE, 0x8E38C95E, 0x701FE543, 0x1B544380, 0x89ACDEFF,
0x51EDB5DE, 0x0E9702D9, 0x6C19AA16, 0xA2913EEE, 0x60754E9A, 0x9819063C, 0xF4709254,
0xD09F9084, 0x772DA259, 0x1DB35DF7, 0x5AA60162, 0x358825D5, 0xB3783BAB};

ethash_keccakf800(state);
for (size_t i = 0; i < 25; ++i)
EXPECT_EQ(state[i], expected_state_1[i]);
}

TEST(helpers, to_hex)
{
hash256 h = {};
Expand Down