From 636f58d88720cf6a6ab7e92288aece257c1bbdc7 Mon Sep 17 00:00:00 2001 From: Joel Brockman <12435369+jbrock24@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:21:56 -0500 Subject: [PATCH] Updated the Psuedocode to show where the LEN of the SEED is obtained correctly, it would have been confusing for others. --- src/sha/sections/04-testtypes.adoc | 7 ++++--- src/sha3/sections/04-testtypes.adoc | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/sha/sections/04-testtypes.adoc b/src/sha/sections/04-testtypes.adoc index 44160965..b7f14dc5 100644 --- a/src/sha/sections/04-testtypes.adoc +++ b/src/sha/sections/04-testtypes.adoc @@ -39,14 +39,15 @@ For j = 0 to 99 SHA-1 and SHA-2 Alternate Monte Carlo Test: [source, code] ---- +INITIAL_SEED_LENGTH = LEN(SEED) For j = 0 to 99 A = B = C = SEED For i = 0 to 999 MSG = A || B || C - if LEN(MSG) >= LEN(SEED): - MSG = leftmost LEN(SEED) bits of MSG + if LEN(MSG) >= INITIAL_SEED_LENGTH: + MSG = leftmost INITIAL_SEED_LENGTH bits of MSG else: - MSG = MSG || LEN(SEED) - LEN(MSG) 0 bits + MSG = MSG || INITIAL_SEED_LENGTH - LEN(MSG) 0 bits MD = SHA(MSG) A = B B = C diff --git a/src/sha3/sections/04-testtypes.adoc b/src/sha3/sections/04-testtypes.adoc index c07502a2..52c0df16 100644 --- a/src/sha3/sections/04-testtypes.adoc +++ b/src/sha3/sections/04-testtypes.adoc @@ -42,13 +42,14 @@ SHA-3 Alternate Monte Carlo Test: [source, code] ---- MD[0] = SEED +INITIAL_SEED_LENGTH = LEN(SEED) For 100 iterations For i = 1 to 1000 MSG = MD[i-1]; - if LEN(MSG) >= LEN(SEED): - MSG = leftmost LEN(SEED) bits of MSG + if LEN(MSG) >= INITIAL_SEED_LENGTH: + MSG = leftmost INITIAL_SEED_LENGTH bits of MSG else: - MSG = MSG || LEN(SEED) - LEN(MSG) 0 bits + MSG = MSG || INITIAL_SEED_LENGTH - LEN(MSG) 0 bits MD[i] = SHA3(MSG) MD[0] = MD[1000] Output MD[0]