A2osX/SYS/KERNEL.S.MD5.txt
2020-01-24 15:21:08 +01:00

116 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*/--------------------------------------
* ## MD5
* Return MD5 Hash for input String
* # C
* `void md5 (const char* str, char* digest);`
* # ASM
* `>PUSHW str`
* `>PUSHW digest`
* `>SYSCALL md5`
* ## RETURN VALUE
* CC
*\--------------------------------------
K.MD5 >DEBUG
>PULLW FORPNT
>PULLYA
>STYA TXTPTR
>SYSCALL2 strlen
>STYA ZPDataLen
sta SETREADAUX
sta SETWRITEAUX
.1 jsr MD5X.Init
bcs .9
pha save MD5 Context hMem
jsr MD5X.Update
jsr MD5X.Finalize
pla
>SYSCALL2 FreeMem Free MD5 Context
clc
.9 sta CLRREADAUX
sta CLRWRITEAUX
rts
*/--------------------------------------
* ## MD5Init
* Initialize a MD5 computation
* # C
* `hMD5 md5init ();`
* # ASM
* `>SYSCALL MD5Init`
* ## RETURN VALUE
* A = hMem To S.MD5
*\--------------------------------------
K.MD5Init sta SETREADAUX
sta SETWRITEAUX
jsr MD5X.Init
sta CLRREADAUX
sta CLRWRITEAUX
rts
*/--------------------------------------
* ## MD5Update
* Add Data to MD5 computation
* # C
* `void md5update (short int md5, char* data, int len);`
* # ASM
* `>PUSHB md5`
* `>PUSHW data`
* `>PUSHW len`
* `>SYSCALL MD5Update`
* ## RETURN VALUE
*\--------------------------------------
K.MD5Update >PULLW ZPDataLen get LEN
>PULLW TXTPTR get DATA
>PULLA
>SYSCALL2 GetMemPtr get MD5 Context
>STYA ZPCtxPtr
sta SETREADAUX
sta SETWRITEAUX
jsr MD5X.Update
sta CLRREADAUX
sta CLRWRITEAUX
rts
*/--------------------------------------
* ## MD5Finalize
* # C
* `void md5finalize (short int md5, char* digest);`
* # ASM
* `>PUSHB md5`
* `>PUSHW digest`
* `>SYSCALL MD5Finalize`
* ## RETURN VALUE
*\--------------------------------------
K.MD5Finalize >PULLW FORPNT
>PULLA
sta .8+1
>SYSCALL2 GetMemPtr
>STYA ZPCtxPtr get MD5 Context
sta SETREADAUX
sta SETWRITEAUX
jsr MD5X.Finalize
.8 lda #$ff SELF MODIFIED
>SYSCALL2 FreeMem
sta CLRREADAUX
sta CLRWRITEAUX
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.MD5
LOAD USR/SRC/SYS/KERNEL.S
ASM