is there a routine to make a string of 16 characters.
the characters must be beetwenn "A" and "Z"
or beetween "0" and "9"

merci
Posted on 2004-03-17 11:10:25 by franlou
Random string?
You must generate 16 numbers (you can take simple generator using GetTickCount() as seed), then for each number:
take remainder of division by ('Z'-'A'+1+10)
if remainder is less than 10, then add '0' to it and store to string
if remainder is greater or equal to 10, then subtract 10 and add 'A' to it, and store to string

by 'A' and 'Z' i mean ascii values of A and Z (65 and 90)
Posted on 2004-03-17 12:34:24 by comrade
If the idea is to generate a random string you can look here:

http://www.asmcommunity.net/board/index.php?topic=16915&perpage=11&pagenumber=2
Posted on 2004-03-17 12:38:03 by donkey
to donkey:
the code of your example is it for MASM?
I don't understand it
FRAME is it a directive?
Posted on 2004-03-21 03:00:07 by franlou
The example of Donkey is for GoAsm, you can translate it easily to Masm. Instead of FRAME & ENDF , you need to use PROC & ENDP in Masm.

For more details, have a look at the GoAsm manual:

http://www.jorgon.freeserve.co.uk/GoasmFrame.htm
Posted on 2004-03-21 03:15:45 by Vortex
Yup,

GoAsm format. To translate it, as Vortex said you change FRAME for PROC and ENDF for ENDP. Then do the jumps...

jmp >L? ; remove the > or <

jmp > ; replace with jmp @F

jmp < ; replace with jmp @B

: ; when alone on a line replace with @@:

I try to make it as generic as possible when I post code but there are some things that have to be different, I just try to keep them to a minimum.
Posted on 2004-03-21 05:04:12 by donkey
merci
I give you my adaptation for MASM
it's seems OK:


GenPassword PROC pString,nChars
pushad
rdtsc
push eax
call Randomize2

mov edi,
xor ecx,ecx
jmp L4
L1:
push ecx
push edi
L2:
push 43
call RandM
cmp eax,11h
jge L3
cmp eax,09h
jle L3
jmp L2
L3:
pop edi
pop ecx
add eax,30h
mov ,al
inc ecx
L4:
cmp ecx,
jl L1
popad
RET
GenPassword ENDP

Randomize2 PROC Seed
lea edi,MT
mov eax,
mov ,eax
mov ecx,N
add edi,4
@@:
mul DWORD PTR
stosd
dec ecx
jnz @B
MOV DWORD PTR ,N;mov D,N
ret
Randomize2 ENDP

RandM PROC limit
push 0
lea edi,MT
cmp DWORD PTR ,N
jb L12
cmp DWORD PTR ,N+1
jnz L2
rdtsc
push eax ; Generate a new seed
call Randomize
L2:
mov esi,edi
L3:
mov eax,
and eax,UM
mov ebx,
and ebx,LM
or eax,ebx
mov ecx,eax
shr eax,1

mov edx,esi
add edx,(M*4)
mov ebx,
xor eax,ebx
and ecx,1
xor eax,
mov ,eax
add esi,4
inc DWORD PTR
cmp DWORD PTR ,(N-M)
jnz L3
L4:
mov eax,
and eax,UM
mov ebx,
and ebx,LM
or eax,ebx
mov ecx,eax
shr eax,1
mov edx,esi
add edx,MN4
mov ebx,
xor eax,ebx
and ecx,1
xor eax,
mov ,eax
add esi,4
inc DWORD PTR
cmp DWORD PTR ,(N-1)
jnz L4
mov edx,edi
add edx,(M-1)*4
mov ebx,
xor eax,ebx
and ecx,1
xor eax,
mov ,eax
mov DWORD PTR ,0
L12:
mov esi,edi
mov eax,
inc DWORD PTR
shl eax,2
add esi,eax
mov eax,
mov ebx,eax
shr eax,11
xor ebx,eax
mov eax,ebx
shl eax,7
and eax,TEMPERING_MASK_B
xor ebx,eax
mov eax,ebx
shl eax,15
and eax,TEMPERING_MASK_C
xor ebx,eax
mov eax,ebx
shr eax,18
xor eax,ebx
xor edx,edx
div DWORD PTR
mov eax,edx
pop ebx
ret
RandM ENDP
Posted on 2004-03-21 12:57:15 by franlou