A2osX/SYS/KERNEL.S.MD5.txt

115 lines
2.2 KiB
Plaintext
Raw Normal View History

2020-01-24 07:00:30 +00:00
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
*\--------------------------------------
2020-01-24 21:53:03 +00:00
K.MD5 >PULLW FORPNT
2020-01-24 07:00:30 +00:00
>PULLYA
>STYA TXTPTR
>SYSCALL2 strlen
>STYA ZPDataLen
sta SETREADAUX
sta SETWRITEAUX
2020-01-24 14:21:08 +00:00
.1 jsr MD5X.Init
2020-01-24 07:00:30 +00:00
bcs .9
2020-01-24 14:21:08 +00:00
2020-01-24 07:00:30 +00:00
pha save MD5 Context hMem
2020-01-24 14:21:08 +00:00
jsr MD5X.Update
jsr MD5X.Finalize
2020-01-24 07:00:30 +00:00
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
2020-01-24 14:21:08 +00:00
jsr MD5X.Init
2020-01-24 07:00:30 +00:00
sta CLRREADAUX
sta CLRWRITEAUX
rts
*/--------------------------------------
* ## MD5Update
* Add Data to MD5 computation
* # C
2020-01-24 14:21:08 +00:00
* `void md5update (short int md5, char* data, int len);`
2020-01-24 07:00:30 +00:00
* # 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
2020-01-24 14:21:08 +00:00
jsr MD5X.Update
2020-01-24 07:00:30 +00:00
sta CLRREADAUX
sta CLRWRITEAUX
rts
*/--------------------------------------
* ## MD5Finalize
* # C
2020-01-24 14:21:08 +00:00
* `void md5finalize (short int md5, char* digest);`
2020-01-24 07:00:30 +00:00
* # 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
2020-01-24 14:21:08 +00:00
jsr MD5X.Finalize
2020-01-24 07:00:30 +00:00
.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