Kernel 0.92, MD5 hash FIX #108

This commit is contained in:
Rémy GIBERT 2018-11-12 12:04:59 +01:00
parent d65677ca17
commit 2d29f081d6
6 changed files with 35 additions and 40 deletions

Binary file not shown.

View File

@ -7,9 +7,8 @@ Return MD5 Hash for input String
`void md5 (const char* str, char* digest);`
# ASM
**In:**
`>PUSHW digest`
`>LDYA str`
`>PUSHW str`
## RETURN VALUE
CC
@ -18,10 +17,10 @@ CC
Initialize a MD5 computation
# C
`HANDLE md5init ();`
`hMD5 md5init ();`
# ASM
**In:**
`>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Init`
## RETURN VALUE
A = hMem To S.MD5
@ -30,24 +29,24 @@ A = hMem To S.MD5
Add Data to MD5 computation
# C
`int md5update (HANDLE md5, char* data, int len);`
`void md5update (hMD5 md5, char* data, int len);`
# ASM
**In:**
`>PUSHW len`
`>PUSHW data`
`>LDA.G md5`
`>hLIBCRYPT,LIBCRYPT.MD5Update`
## RETURN VALUE
## MD5Finalize
# C
`int md5finalize (HANDLE md5, char* digest);`
`void md5finalize (hMD5 md5, char* digest);`
# ASM
**In:**
`>PUSHW digest`
`>LDA.G md5`
`>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Finalize`
## RETURN VALUE

Binary file not shown.

Binary file not shown.

View File

@ -39,7 +39,15 @@ L.LIBCRYPT .DA LIBCRYPT
L.MSG.USAGE .DA MSG.USAGE
.DA 0
*--------------------------------------
CS.INIT ldy #S.PS.ARGC
CS.INIT >LDYA L.LIBCRYPT
>SYSCALL LoadLib
bcs .9
sta hLIBCRYPT
.9 rts
*--------------------------------------
CS.RUN ldy #S.PS.ARGC
lda (pPs),y
dec
beq .99
@ -85,28 +93,20 @@ CS.INIT ldy #S.PS.ARGC
>STA.G Arg
bra .1
.8 >LDYA L.LIBCRYPT
>SYSCALL LoadLib
bcs .9
.8 >LDA.G Arg
beq .99
sta hLIBCRYPT
clc
.9 rts
*--------------------------------------
CS.RUN >LDA.G bText
>LDA.G bText
beq CS.RUN.FILE
*--------------------------------------
CS.RUN.TEXT >LDA.G Arg
CS.RUN.TEXT >PUSHEA.G MD5Buf
>LDA.G Arg
>SYSCALL ArgV
>PUSHYA
>PUSHEA.G MD5Buf
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5
bcs CS.RUN.TEXT.RTS
jmp CS.RUN.PRINT
CS.RUN.TEXT.RTS rts
*--------------------------------------
CS.RUN.FILE >LDYAI FILEBUF.SIZE
>SYSCALL getmem
@ -116,12 +116,11 @@ CS.RUN.FILE >LDYAI FILEBUF.SIZE
>STA.G hDataBuf
>PUSHWI 0 Aux type
>PUSHBI 0
>PUSHBI 0 ftype
>PUSHBI O.RDONLY
>LDA.G Arg
>SYSCALL ArgV
>SYSCALL FOpen
bcs .9
>STA.G hFile
@ -143,12 +142,12 @@ CS.RUN.FILE >LDYAI FILEBUF.SIZE
.2 >PUSHYA MD5 DataLen
>PUSHW ZPDataBufPtr
>PUSHB.G hMD5Ctx
>LDA.G hMD5Ctx
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Update
bra .1
.8 >PUSHEA.G MD5Buf
>PUSHB.G hMD5Ctx
>LDA.G hMD5Ctx
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Finalize
CS.RUN.PRINT >LEA.G MD5Buf

View File

@ -116,16 +116,14 @@ LIB.UNLOAD clc
* # C
* `void md5 (const char* str, char* digest);`
* # ASM
* **In:**
* `>PUSHW digest`
* `>LDYA str`
* `>PUSHW str`
* ## RETURN VALUE
* CC
*\--------------------------------------
MD5 >STYA ZPDataPtr
MD5 >PULLW ZPDataPtr
>PULLW ZPHashPtr
>PULLYA
>LDYA ZPDataPtr
>SYSCALL strlen
>STYA ZPDataLen
@ -146,9 +144,9 @@ MD5 >STYA ZPDataPtr
* ## MD5Init
* Initialize a MD5 computation
* # C
* `HANDLE md5init ();`
* `hMD5 md5init ();`
* # ASM
* **In:**
* `>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Init`
* ## RETURN VALUE
* A = hMem To S.MD5
*\--------------------------------------
@ -180,12 +178,12 @@ MD5Init >LDYAI S.MD5
* ## MD5Update
* Add Data to MD5 computation
* # C
* `int md5update (HANDLE md5, char* data, int len);`
* `void md5update (hMD5 md5, char* data, int len);`
* # ASM
* **In:**
* `>PUSHW len`
* `>PUSHW data`
* `>LDA.G md5`
* `>hLIBCRYPT,LIBCRYPT.MD5Update`
* ## RETURN VALUE
*\--------------------------------------
MD5Update >SYSCALL GetMemPtr get MD5 Context
@ -267,15 +265,14 @@ MD5Update.I ldy #S.MD5.FINALIZED
*/--------------------------------------
* ## MD5Finalize
* # C
* `int md5finalize (HANDLE md5, char* digest);`
* `void md5finalize (hMD5 md5, char* digest);`
* # ASM
* **In:**
* `>PUSHW digest`
* `>LDA.G md5`
* `>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Finalize`
* ## RETURN VALUE
*\--------------------------------------
MD5Finalize >PULLA
pha
MD5Finalize pha
>SYSCALL GetMemPtr
>STYA ZPCtxPtr get MD5 Context