I would like to convert an ascii string to hex so it looks like
mystring db 07Fh,023h,0EAh,097h,073h,0F8h,09Ah,0A8h,0EEh,03Dh,0A2h,0A3h,063h,01Fh,01Ch,084h
db 0CDh,0AEh,072h,005h,0C2h,075h,055h,0B8h,0E6h,036h,004h,046h,0C8h,0FFh,0C9h,0DCh,0
I have source that works on entire file content that does the above in masm but can't get it to work just for strings. Another problem I have that's slightly off-topic is i'm string comparing hash'd strings that's why i'm converting to hex, is there anyway I can avoid null terminating or otherwise problematic characters in my hash string?
E^cube,
I not sure if what you want is this, but:
;esi==string offset (asciiz)
;edi=dest buffer
str2hex:
pushad
mov ebx, offset hex_table
@@1:
lodsb
test al,al
jz @@2
push eax
and eax,01111b
xlat
stosb
pop eax
shr eax,4
and eax,01111b
xlat
stosb
jmp @@1
@@2:
popad
ret
hex_table db "0123456789abcdef"
i hope it help
jmgk
yes, that's close enough, thankyou for your time.