News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

beginner and strings

Started by yaki, May 16, 2006, 05:24:18 PM

Previous topic - Next topic

yaki

hi all
I am a beginner...and I think that works  with  strings is important.
I work with a sniffer and I have an output like 1DA0206548....and I would like to reformat this output to have %1D%A0%20%65%48

any help will be appreciate

Thanks in advance

yaki

hutch--

yaki,

I moved the topic to the Campus so you had a better chance of a reply. Just make sure that the question you are asking is not cracking or reverse engineering related as we cannot allow that under the forum rules.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Ossa

#2
Hi,

try this

ConvertString PROC pszOut:DWORD, pszIn:DWORD

push edi
push esi

mov edi, pszOut
mov esi, pszIn

@@:

mov ax, [esi]
or  al, al
jz  @F
or  ah, ah ; These lines aren't needed if the input
jz  @F ; string is certain to be even in length

shl eax, 8
mov al, '%'
mov [edi], eax

add edi, 3
add esi, 2
jmp @B

@@:

mov [edi], byte ptr 0

pop esi
pop edi

ret
ConvertString ENDP


It's not optimised or anything, but it works.

Hope that helps,
Ossa
Website (very old): ossa.the-wot.co.uk

yaki

hi
it is not the cracking or hacking but a simple strings manipulation.
thanks Ossa