Functions
K256_DATA
function
#
Round specific constants
func K256_DATA() Mem
addm
function
#
addm (mem), reg
- Add reg to mem using reg-mem add and store
func addm(P1 Mem, P2 GPPhysical)
avx2_do_last_block
function
#
func avx2_do_last_block()
avx2_last_block_enter
function
#
func avx2_last_block_enter()
avx2_loop0
function
#
func avx2_loop0()
avx2_loop1
function
#
for w0 - w47
func avx2_loop1()
avx2_loop2
function
#
w48 - w63 processed with no scheduling (last 16 rounds)
func avx2_loop2()
avx2_loop3
function
#
Do second block using previously scheduled results
func avx2_loop3()
avx2_only_one_block
function
#
Load initial digest
func avx2_only_one_block()
blockAMD64
function
#
func blockAMD64()
blockAVX2
function
#
func blockAVX2()
blockSHANI
function
#
func blockSHANI()
doRoundN0
function
#
func doRoundN0(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)
doRoundN1
function
#
func doRoundN1(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)
doRoundN2
function
#
func doRoundN2(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)
doRoundN3
function
#
func doRoundN3(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, old_h GPPhysical)
done
function
#
func done()
done_hash
function
#
func done_hash()
end
function
#
func end()
flip_mask_DATA
function
#
shuffle byte order from LE to BE
func flip_mask_DATA() Mem
loop
function
#
func loop()
main
function
#
func main()
msgSchedule0
function
#
Wt = Mt; for 0 <= t <= 15
func msgSchedule0(index int)
msgSchedule1
function
#
Wt = SIGMA1(Wt-2) + Wt-7 + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 63
SIGMA0(x) = ROTR(7,x) XOR ROTR(18,x) XOR SHR(3,x)
SIGMA1(x) = ROTR(17,x) XOR ROTR(19,x) XOR SHR(10,x)
func msgSchedule1(index int)
nop
function
#
nop instead of final SHA256MSG1 for first and last few rounds
func nop(m VecPhysical, a VecPhysical)
rotateRight
function
#
func rotateRight(slice *[]GPPhysical) []GPPhysical
roundAndSchedN0
function
#
func roundAndSchedN0(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)
roundAndSchedN1
function
#
func roundAndSchedN1(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)
roundAndSchedN2
function
#
func roundAndSchedN2(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)
roundAndSchedN3
function
#
func roundAndSchedN3(disp int, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical, XDWORD0 VecPhysical, XDWORD1 VecPhysical, XDWORD2 VecPhysical, XDWORD3 VecPhysical)
roundLoop
function
#
func roundLoop()
rounds0to11
function
#
sha rounds 0 to 11
identical with the exception of the final msg op
which is replaced with a nop for rounds where it is not needed
refer to Gulley, et al for more information
func rounds0to11(m VecPhysical, a VecPhysical, c int, sha256msg1 VecFunc)
rounds12to59
function
#
sha rounds 12 to 59
identical with the exception of the final msg op
and the reverse copy(m,msg) in round 12 which is required
after the last data load
refer to Gulley, et al for more information
func rounds12to59(m VecPhysical, c int, a VecPhysical, t VecPhysical, sha256msg1 VecFunc, movop VecFunc)
sha256Round
function
#
Calculate T1 and T2, then e = d + T1 and a = T1 + T2.
The values for e and a are stored in d and h, ready for rotation.
func sha256Round(index int, konst uint32, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)
sha256Round0
function
#
func sha256Round0(index int, konst uint32, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)
sha256Round1
function
#
func sha256Round1(index int, konst uint32, a GPPhysical, b GPPhysical, c GPPhysical, d GPPhysical, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)
sha256T1
function
#
Calculate T1 in AX - uses AX, CX and DX registers.
h is also used as an accumulator. Wt is passed in AX.
T1 = h + BIGSIGMA1(e) + Ch(e, f, g) + Kt + Wt
BIGSIGMA1(x) = ROTR(6,x) XOR ROTR(11,x) XOR ROTR(25,x)
Ch(x, y, z) = (x AND y) XOR (NOT x AND z)
func sha256T1(konst uint32, e GPPhysical, f GPPhysical, g GPPhysical, h GPPhysical)
sha256T2
function
#
Calculate T2 in BX - uses BX, CX, DX and DI registers.
T2 = BIGSIGMA0(a) + Maj(a, b, c)
BIGSIGMA0(x) = ROTR(2,x) XOR ROTR(13,x) XOR ROTR(22,x)
Maj(x, y, z) = (x AND y) XOR (x AND z) XOR (y AND z)
func sha256T2(a GPPhysical, b GPPhysical, c GPPhysical)
sha256msg1
function
#
final SHA256MSG1 for middle rounds that require it
func sha256msg1(m VecPhysical, a VecPhysical)
shuff_00BA_DATA
function
#
shuffle xBxA -> 00BA
func shuff_00BA_DATA() Mem
shuff_DC00_DATA
function
#
shuffle xDxC -> DC00
func shuff_DC00_DATA() Mem
vmov
function
#
msg copy for all but rounds 12-15
func vmov(a VecPhysical, b VecPhysical)
vmovrev
function
#
reverse copy for rounds 12-15
func vmovrev(a VecPhysical, b VecPhysical)