📄 haval.asm
字号:
HavalPASS5_T5 t6, t5, t4, t3, t2, t1, t0, t7, [edi+4*03], 07EFB2A98h
HavalPASS5_T5 t5, t4, t3, t2, t1, t0, t7, t6, [edi+4*21], 0A1F1651Dh
HavalPASS5_T5 t4, t3, t2, t1, t0, t7, t6, t5, [edi+4*26], 039AF0176h
HavalPASS5_T5 t3, t2, t1, t0, t7, t6, t5, t4, [edi+4*17], 066CA593Eh
HavalPASS5_T5 t2, t1, t0, t7, t6, t5, t4, t3, [edi+4*11], 082430E88h
HavalPASS5_T5 t1, t0, t7, t6, t5, t4, t3, t2, [edi+4*20], 08CEE8619h
HavalPASS5_T5 t0, t7, t6, t5, t4, t3, t2, t1, [edi+4*29], 0456F9FB4h
HavalPASS5_T5 t7, t6, t5, t4, t3, t2, t1, t0, [edi+4*19], 07D84A5C3h
HavalPASS5_T5 t6, t5, t4, t3, t2, t1, t0, t7, [edi+4*00], 03B8B5EBEh
HavalPASS5_T5 t5, t4, t3, t2, t1, t0, t7, t6, [edi+4*12], 0E06F75D8h
HavalPASS5_T5 t4, t3, t2, t1, t0, t7, t6, t5, [edi+4*07], 085C12073h
HavalPASS5_T5 t3, t2, t1, t0, t7, t6, t5, t4, [edi+4*13], 0401A449Fh
HavalPASS5_T5 t2, t1, t0, t7, t6, t5, t4, t3, [edi+4*08], 056C16AA6h
HavalPASS5_T5 t1, t0, t7, t6, t5, t4, t3, t2, [edi+4*31], 04ED3AA62h
HavalPASS5_T5 t0, t7, t6, t5, t4, t3, t2, t1, [edi+4*10], 0363F7706h
HavalPASS5_T5 t7, t6, t5, t4, t3, t2, t1, t0, [edi+4*05], 01BFEDF72h
HavalPASS5_T5 t6, t5, t4, t3, t2, t1, t0, t7, [edi+4*09], 0429B023Dh
HavalPASS5_T5 t5, t4, t3, t2, t1, t0, t7, t6, [edi+4*14], 037D0D724h
HavalPASS5_T5 t4, t3, t2, t1, t0, t7, t6, t5, [edi+4*30], 0D00A1248h
HavalPASS5_T5 t3, t2, t1, t0, t7, t6, t5, t4, [edi+4*18], 0DB0FEAD3h
HavalPASS5_T5 t2, t1, t0, t7, t6, t5, t4, t3, [edi+4*06], 049F1C09Bh
HavalPASS5_T5 t1, t0, t7, t6, t5, t4, t3, t2, [edi+4*28], 0075372C9h
HavalPASS5_T5 t0, t7, t6, t5, t4, t3, t2, t1, [edi+4*24], 080991B7Bh
HavalPASS5_T5 t7, t6, t5, t4, t3, t2, t1, t0, [edi+4*02], 025D479D8h
HavalPASS5_T5 t6, t5, t4, t3, t2, t1, t0, t7, [edi+4*23], 0F6E8DEF7h
HavalPASS5_T5 t5, t4, t3, t2, t1, t0, t7, t6, [edi+4*16], 0E3FE501Ah
HavalPASS5_T5 t4, t3, t2, t1, t0, t7, t6, t5, [edi+4*22], 0B6794C3Bh
HavalPASS5_T5 t3, t2, t1, t0, t7, t6, t5, t4, [edi+4*04], 0976CE0BDh
HavalPASS5_T5 t2, t1, t0, t7, t6, t5, t4, t3, [edi+4*01], 004C006BAh
HavalPASS5_T5 t1, t0, t7, t6, t5, t4, t3, t2, [edi+4*25], 0C1A94FB6h
HavalPASS5_T5 t0, t7, t6, t5, t4, t3, t2, t1, [edi+4*15], 0409F60C4h
mov eax,t0
mov ebx,t1
mov ecx,t2
mov edx,t3
add [esi+0*4],eax
add [esi+1*4],ebx
add [esi+2*4],ecx
add [esi+3*4],edx
mov eax,t4
mov ebx,t5
mov ecx,t6
mov edx,t7
add [esi+4*4],eax
add [esi+5*4],ebx
add [esi+6*4],ecx
add [esi+7*4],edx
popad
ret
HavalTransform5 endp
align 4
HavalTransform proc
.if HavalPASS == 3
call HavalTransform3
.elseif HavalPASS == 4
call HavalTransform4
.else
call HavalTransform5
.endif
ret
HavalTransform endp
align 4
HavalInit proc uses esi edi DigestSizeBits:dword,Passes:dword
mov eax,Passes
mov edx,DigestSizeBits
mov HavalPASS,eax
mov HavalSIZE,edx
xor eax,eax
mov HavalLen,eax
HavalBURN
mov eax,Offset HavalDigest; for setting start digest
mov dword ptr [eax+0*4],0243F6A88h
mov dword ptr [eax+1*4],085A308D3h
mov dword ptr [eax+2*4],013198A2Eh
mov dword ptr [eax+3*4],003707344h
mov dword ptr [eax+4*4],0A4093822h
mov dword ptr [eax+5*4],0299F31D0h
mov dword ptr [eax+6*4],0082EFA98h
mov dword ptr [eax+7*4],0EC4E6C89h
ret
HavalInit endp
align 4
HavalUpdate proc uses esi edi ebx lpBuffer:dword, dwBufLen:dword
mov ebx,dwBufLen
add HavalLen,ebx
.while ebx
mov eax,HavalIndex
mov edx,128
sub edx,eax
.if edx <= ebx
lea edi, [HavalHashBuf+eax]
mov esi, lpBuffer
mov ecx, edx
rep movsb
sub ebx, edx
add lpBuffer, edx
call HavalTransform
HavalBURN
.else
lea edi, [HavalHashBuf+eax]
mov esi, lpBuffer
mov ecx, ebx
rep movsb
mov eax, HavalIndex
add eax, ebx
mov HavalIndex,eax
.break
.endif
.endw
ret
HavalUpdate endp
align 4
HavalFinal proc uses esi edi ebx
mov ecx,HavalIndex
IFDEF HavalOLD
mov byte ptr [HavalHashBuf+ecx],80h
ELSE
mov byte ptr [HavalHashBuf+ecx],01h
ENDIF
.if ecx >= 118
call HavalTransform
HavalBURN
.endif
mov eax,HavalSIZE
shl eax,6
mov edx,HavalPASS
shl edx,3
or eax,HavalVERSION
or eax,edx
mov word ptr [HavalHashBuf+118], ax
mov eax,HavalLen
xor edx,edx
shld edx,eax,3
shl eax,3
mov dword ptr [HavalHashBuf+120],eax
mov dword ptr [HavalHashBuf+120+4],edx
call HavalTransform
mov esi,offset HavalDigest
.if HavalSIZE == 128
mov eax,[esi+7*4]
mov ebx,[esi+6*4]
mov ecx,[esi+5*4]
mov edx,[esi+4*4]
and eax,0000000FFh
and ebx,0FF000000h
and ecx,000FF0000h
and edx,00000FF00h
or eax,ebx
or eax,ecx
or eax,edx
ror eax,8
add eax,[esi+0*4]
mov [esi+0*4],eax
mov eax,[esi+7*4]
mov ebx,[esi+6*4]
mov ecx,[esi+5*4]
mov edx,[esi+4*4]
and eax,00000FF00h
and ebx,0000000FFh
and ecx,0FF000000h
and edx,000FF0000h
or eax,ebx
or eax,ecx
or eax,edx
ror eax,16
add eax,[esi+1*4]
mov [esi+1*4],eax
mov eax,[esi+7*4]
mov ebx,[esi+6*4]
mov ecx,[esi+5*4]
mov edx,[esi+4*4]
and eax,000FF0000h
and ebx,00000FF00h
and ecx,0000000FFh
and edx,0FF000000h
or eax,ebx
or eax,ecx
or eax,edx
ror eax,24
add eax,[esi+2*4]
mov [esi+2*4],eax
mov eax,[esi+7*4]
mov ebx,[esi+6*4]
mov ecx,[esi+5*4]
mov edx,[esi+4*4]
and eax,0FF000000h
and ebx,000FF0000h
and ecx,00000FF00h
and edx,0000000FFh
or eax,ebx
or eax,ecx
or eax,edx
add eax,[esi+3*4]
mov [esi+3*4],eax
.elseif HavalSIZE == 160
mov eax, [esi+7*4]
mov edx, [esi+6*4]
mov ecx, [esi+5*4]
and eax, 3Fh
and edx, (7Fh SHL 25)
and ecx, (3Fh SHL 19)
or eax, edx
or eax, ecx
ror eax, 19
add [esi+0*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
mov edx, [esi+5*4]
and eax, (3Fh SHL 6)
and ecx, 3Fh
and edx, (7Fh SHL 25)
or eax, edx
or eax, ecx
ror eax, 25
add [esi+1*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
mov edx, [esi+5*4]
and eax, (7Fh SHL 12)
and ecx, (3Fh SHL 6)
and edx, 3Fh
or eax, edx
or eax, ecx
add [esi+2*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
mov edx, [esi+5*4]
and eax, (3Fh SHL 19)
and ecx, (7Fh SHL 12)
and edx, (3Fh SHL 6)
or eax, edx
or eax, ecx
shr eax, 6
add [esi+3*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
mov edx, [esi+5*4]
and eax, (7Fh SHL 25)
and ecx, (3Fh SHL 19)
and edx, (7Fh SHL 12)
or eax, edx
or eax, ecx
shr eax, 12
add [esi+4*4], eax
.elseif HavalSIZE == 192
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
and eax, 1Fh
and ecx, (3Fh SHL 26)
or eax, ecx
ror eax, 26
add [esi+0*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
and eax, (1Fh SHL 5)
and ecx, 1Fh
or eax, ecx
add [esi+1*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
and eax, (3Fh SHL 10)
and ecx, (1Fh SHL 5)
or eax, ecx
shr eax, 5
add [esi+2*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
and eax, (1Fh SHL 16)
and ecx, (3Fh SHL 10)
or eax, ecx
shr eax, 10
add [esi+3*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
and eax, (1Fh SHL 21)
and ecx, (1Fh SHL 16)
or eax, ecx
shr eax, 16
add [esi+4*4], eax
mov eax, [esi+7*4]
mov ecx, [esi+6*4]
and eax, (3Fh SHL 26)
and ecx, (1Fh SHL 21)
or eax, ecx
shr eax, 21
add [esi+5*4], eax
.elseif HavalSIZE == 224
mov eax, [esi+7*4]
mov ebx,eax
mov ecx,eax
mov edx,eax
mov edi,eax
shr eax, 27
and eax, 1Fh
shr ebx, 22
and ebx, 1Fh
shr ecx, 18
and ecx, 0Fh
shr edx, 13
and edx, 1Fh
shr edi, 9
and edi, 0Fh
add [esi+0*4], eax
add [esi+1*4], ebx
add [esi+2*4], ecx
add [esi+3*4], edx
add [esi+4*4], edi
mov eax,[esi+7*4]
mov edx,eax
shr eax,4
and eax,1Fh
and edx,0Fh
add [esi+5*4], eax
add [esi+6*4], edx
.endif
mov eax,esi
ret
HavalFinal endp
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -