Skip to content

Commit

Permalink
Updated the Psuedocode to show where the LEN of the SEED is obtained …
Browse files Browse the repository at this point in the history
…correctly, it would have been confusing for others.
  • Loading branch information
jbrock24 committed Dec 13, 2023
1 parent 1b86e1b commit 636f58d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/sha/sections/04-testtypes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/sha3/sections/04-testtypes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 636f58d

Please sign in to comment.