This commit is contained in:
Nicholas Ward 2022-11-04 15:27:34 -07:00
parent a1ea7ff930
commit 9a5db4b8d2
3 changed files with 38 additions and 6 deletions

View File

@ -4,4 +4,18 @@
global blake_compression:
// stack: h_0, ..., h_7, t_0, t_1, f_0, f_1, m_0, ..., m_15
%blake_compression_internal_state_addr
// stack: start, h_0, ..., h_7, t_0, t_1, f_0, f_1, m_0, ..., m_15
%rep 8
SWAP1
DUP2
%mstore_kernel_general
%increment
%endrep
// stack: start + 8, t_0, t_1, f_0, f_1, m_0, ..., m_15
PUSH 0
// stack: 0, start + 8, t_0, t_1, f_0, f_1, m_0, ..., m_15
%rep 4
%endrep

View File

@ -1,4 +1,4 @@
global blake_iv:
global blake_iv_const:
// IV constants (big-endian)
// IV_0
@ -32,3 +32,25 @@ global blake_iv:
// IV_7
BYTES 91, 224, 205, 25
BYTES 19, 126, 33, 121
%macro blake_iv(i)
PUSH blake_iv_const
// stack: blake_iv_const
PUSH $i
// stack: i, blake_iv_const
%mul_const(2)
ADD
// stack: blake_iv_const + 2 * i
DUP1
// stack: blake_iv_const + 2 * i, blake_iv_const + 2 * i
%increment
// stack: blake_iv_const + 2 * i, blake_iv_const + 2 * i
%mload_kernel_code
SWAP1
%increment
// stack: IV_i[32:], IV_i[:32]
%shl_const(32)
// stack: IV_i[32:] << 32, IV_i[:32]
ADD
// stack: IV_i
%endmacro

View File

@ -92,7 +92,3 @@ global blake_g_function:
%mstore_kernel_general
ADD
%mstore_kernel_general