fixes and addressed comments

This commit is contained in:
Nicholas Ward 2022-12-12 17:29:56 -08:00
parent 24d6627a62
commit a564d7350c
3 changed files with 15 additions and 47 deletions

View File

@ -235,35 +235,35 @@ compression_end:
// stack: h_0', h_1', h_2', h_3', h_4', h_5', h_6', h_7', cur_block + 1, retdest
// Invert the bytes of each hash value.
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_0'', h_1', h_2', h_3', h_4', h_5', h_6', h_7', cur_block + 1, retdest
SWAP1
// stack: h_1', h_0'', h_2', h_3', h_4', h_5', h_6', h_7', cur_block + 1, retdest
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_1'', h_0'', h_2', h_3', h_4', h_5', h_6', h_7', cur_block + 1, retdest
SWAP2
// stack: h_2', h_0'', h_1'', h_3', h_4', h_5', h_6', h_7', cur_block + 1, retdest
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_2'', h_0'', h_1'', h_3', h_4', h_5', h_6', h_7', cur_block + 1, retdest
SWAP3
// stack: h_3', h_0'', h_1'', h_2'', h_4', h_5', h_6', h_7', cur_block + 1, retdest
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_3'', h_0'', h_1'', h_2'', h_4', h_5', h_6', h_7', cur_block + 1, retdest
SWAP4
// stack: h_4', h_0'', h_1'', h_2'', h_3'', h_5', h_6', h_7', cur_block + 1, retdest
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_4'', h_0'', h_1'', h_2'', h_3'', h_5', h_6', h_7', cur_block + 1, retdest
SWAP5
// stack: h_5', h_0'', h_1'', h_2'', h_3'', h_4'', h_6', h_7', cur_block + 1, retdest
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_5'', h_0'', h_1'', h_2'', h_3'', h_4'', h_6', h_7', cur_block + 1, retdest
SWAP6
// stack: h_6', h_0'', h_1'', h_2'', h_3'', h_4'', h_5'', h_7', cur_block + 1, retdest
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_6'', h_0'', h_1'', h_2'', h_3'', h_4'', h_5'', h_7', cur_block + 1, retdest
SWAP7
// stack: h_7', h_0'', h_1'', h_2'', h_3'', h_4'', h_5'', h_6'', cur_block + 1, retdest
%reverse_bytes_u64_blake
%reverse_bytes_u64
// stack: h_7'', h_0'', h_1'', h_2'', h_3'', h_4'', h_5'', h_6'', cur_block + 1, retdest
%stack (h_7, h_s: 7) -> (h_s, h_7)
// stack: h_0'', h_1'', h_2'', h_3'', h_4'', h_5'', h_6'', h_7'', cur_block + 1, retdest

View File

@ -13,12 +13,12 @@ global permutation_1_constants:
global permutation_2_constants:
BYTES 11, 8, 12, 0
BYTES 5, 2, 15, 13
BYTES 10, 4, 3, 6
BYTES 10, 14, 3, 6
BYTES 7, 1, 9, 4
global permutation_3_constants:
BYTES 7, 9, 3, 1
BYTES 13, 2, 11, 14
BYTES 13, 12, 11, 14
BYTES 2, 6, 5, 10
BYTES 4, 0, 15, 8
@ -29,14 +29,14 @@ global permutation_4_constants:
BYTES 6, 8, 3, 13
global permutation_5_constants:
BYTES 2, 2, 6, 10
BYTES 0, 1, 8, 3
BYTES 4, 3, 7, 5
BYTES 15, 4, 1, 9
BYTES 2, 12, 6, 10
BYTES 0, 11, 8, 3
BYTES 4, 13, 7, 5
BYTES 15, 14, 1, 9
global permutation_6_constants:
BYTES 12, 5, 1, 15
BYTES 14, 3, 4, 10
BYTES 14, 13, 4, 10
BYTES 0, 7, 6, 3
BYTES 9, 2, 8, 11

View File

@ -335,35 +335,3 @@
OR
// stack: word_inverted
%endmacro
// Invert the order of the four bytes in a word.
%macro invert_four_byte_word
// stack: word
%mul_const(0x1000000010000000100)
%and_const(0xff0000ff00ff00000000ff0000)
%mod_const(0xffffffffffff)
// stack: word_inverted
%endmacro
// Invert the order of the eight bytes in a Blake word.
%macro reverse_bytes_u64_blake
// stack: word
DUP1
// stack: word, word
%and_const(0xffffffff)
// stack: word_lo, word
SWAP1
// stack: word, word_lo
%shr_const(32)
// stack: word_hi, word_lo
%invert_four_byte_word
// stack: word_hi_inverted, word_lo
SWAP1
// stack: word_lo, word_hi_inverted
%invert_four_byte_word
// stack: word_lo_inverted, word_hi_inverted
%shl_const(32)
OR
// stack: word_inverted
%endmacro