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);` `void md5 (const char* str, char* digest);`
# ASM # ASM
**In:**
`>PUSHW digest` `>PUSHW digest`
`>LDYA str` `>PUSHW str`
## RETURN VALUE ## RETURN VALUE
CC CC
@ -18,10 +17,10 @@ CC
Initialize a MD5 computation Initialize a MD5 computation
# C # C
`HANDLE md5init ();` `hMD5 md5init ();`
# ASM # ASM
**In:** `>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Init`
## RETURN VALUE ## RETURN VALUE
A = hMem To S.MD5 A = hMem To S.MD5
@ -30,24 +29,24 @@ A = hMem To S.MD5
Add Data to MD5 computation Add Data to MD5 computation
# C # C
`int md5update (HANDLE md5, char* data, int len);` `void md5update (hMD5 md5, char* data, int len);`
# ASM # ASM
**In:**
`>PUSHW len` `>PUSHW len`
`>PUSHW data` `>PUSHW data`
`>LDA.G md5` `>LDA.G md5`
`>hLIBCRYPT,LIBCRYPT.MD5Update`
## RETURN VALUE ## RETURN VALUE
## MD5Finalize ## MD5Finalize
# C # C
`int md5finalize (HANDLE md5, char* digest);` `void md5finalize (hMD5 md5, char* digest);`
# ASM # ASM
**In:**
`>PUSHW digest` `>PUSHW digest`
`>LDA.G md5` `>LDA.G md5`
`>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Finalize`
## RETURN VALUE ## 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 L.MSG.USAGE .DA MSG.USAGE
.DA 0 .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 lda (pPs),y
dec dec
beq .99 beq .99
@ -85,28 +93,20 @@ CS.INIT ldy #S.PS.ARGC
>STA.G Arg >STA.G Arg
bra .1 bra .1
.8 >LDYA L.LIBCRYPT .8 >LDA.G Arg
>SYSCALL LoadLib beq .99
bcs .9
sta hLIBCRYPT >LDA.G bText
clc
.9 rts
*--------------------------------------
CS.RUN >LDA.G bText
beq CS.RUN.FILE beq CS.RUN.FILE
*-------------------------------------- *--------------------------------------
CS.RUN.TEXT >LDA.G Arg CS.RUN.TEXT >PUSHEA.G MD5Buf
>LDA.G Arg
>SYSCALL ArgV >SYSCALL ArgV
>PUSHYA >PUSHYA
>PUSHEA.G MD5Buf
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5 >LIBCALL hLIBCRYPT,LIBCRYPT.MD5
bcs CS.RUN.TEXT.RTS
jmp CS.RUN.PRINT jmp CS.RUN.PRINT
CS.RUN.TEXT.RTS rts
*-------------------------------------- *--------------------------------------
CS.RUN.FILE >LDYAI FILEBUF.SIZE CS.RUN.FILE >LDYAI FILEBUF.SIZE
>SYSCALL getmem >SYSCALL getmem
@ -116,12 +116,11 @@ CS.RUN.FILE >LDYAI FILEBUF.SIZE
>STA.G hDataBuf >STA.G hDataBuf
>PUSHWI 0 Aux type >PUSHWI 0 Aux type
>PUSHBI 0 >PUSHBI 0 ftype
>PUSHBI O.RDONLY >PUSHBI O.RDONLY
>LDA.G Arg >LDA.G Arg
>SYSCALL ArgV >SYSCALL ArgV
>SYSCALL FOpen >SYSCALL FOpen
bcs .9 bcs .9
>STA.G hFile >STA.G hFile
@ -143,12 +142,12 @@ CS.RUN.FILE >LDYAI FILEBUF.SIZE
.2 >PUSHYA MD5 DataLen .2 >PUSHYA MD5 DataLen
>PUSHW ZPDataBufPtr >PUSHW ZPDataBufPtr
>PUSHB.G hMD5Ctx >LDA.G hMD5Ctx
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Update >LIBCALL hLIBCRYPT,LIBCRYPT.MD5Update
bra .1 bra .1
.8 >PUSHEA.G MD5Buf .8 >PUSHEA.G MD5Buf
>PUSHB.G hMD5Ctx >LDA.G hMD5Ctx
>LIBCALL hLIBCRYPT,LIBCRYPT.MD5Finalize >LIBCALL hLIBCRYPT,LIBCRYPT.MD5Finalize
CS.RUN.PRINT >LEA.G MD5Buf CS.RUN.PRINT >LEA.G MD5Buf

View File

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