No worries, I will slow down again.

One thing that bothered me most with all the encryption and hash libs was the bad handling of keys and such. I made a little helper library therefor:
axLib - http://www.host4scripts.de/pub/axLib.zip
Here the code I previously used:
Code: Select all
;the old way:
HexString.s = "10E06B990D44DE0091A2113FD95C92FC905166AF147AA7632639C41AA7F26B1620C47443813C605B924C05591C161ECC35944FC69C4433A49D10FC6B04A33611"
BufferSize = Len(HexString.s)/2
*Buffer = AllocateMemory(BufferSize)
;poke the hexstring into the buffer, 2 characters of HexString are one value in memory
;procedure from PB / english forum - we need that as helper
Procedure.l hex2dec(h$)
h$=UCase(h$)
For r=1 To Len(h$)
d<<4 : a$=Mid(h$,r,1)
If Asc(a$)>60
d+Asc(a$)-55
Else
d+Asc(a$)-48
EndIf
Next
ProcedureReturn d
EndProcedure
j=-1
For i=1 To Len(HexString) Step 2
j=j+1
PokeB(*Buffer+j,Hex2Dec(Mid(HexString.s,i,2)))
Next i
;let's show the buffer in hexa again
;Result.s=axBufferToHexString(*Buffer,Buffersize)
For i=1 To BufferSize
Result.s = Result.s+RSet(Hex(PeekB(*Buffer+i-1) & $FF),2,"0")
Next i
Debug Result
;just here for reference to the third function in the other sample
Decimal = Hex2Dec("A0")
Debug Decimal
Code: Select all
;axLib - http://www.host4scripts.de/pub/axLib.zip
HexString.s = "10E06B990D44DE0091A2113FD95C92FC905166AF147AA7632639C41AA7F26B1620C47443813C605B924C05591C161ECC35944FC69C4433A49D10FC6B04A33611"
BufferSize = Len(HexString.s)/2
*Buffer = AllocateMemory(BufferSize)
;poke the hexstring into the buffer, 2 characters of HexString are one value in memory
axHexStringToBuffer(HexString.s,*Buffer)
;let's show the buffer in hexa again
Result.s=axBufferToHexString(*Buffer,Buffersize)
Debug Result.s
;sideproduct of the above routines. Takes just one byte, but is relatively fast.
Decimal = axHexByteStringToDecimal("A0")
Debug Decimal