- // cette procédure crypte une chaine en la parcourant de son premier à son dernier caractère (l'adresse du premier caractère étant passé dans EAX)
-
- procedure crypt(s: String); register;
- asm
- mov ecx, eax
- @loop:
- mov al, byte ptr [ecx]
- test al, al
- jz @exit
- mov al, byte ptr [ecx + 1]
- xor byte ptr [ecx], al
- not byte ptr [ecx]
- inc ecx
- jmp @loop
- @exit:
- end;
-
- // cette procédure crypte une chaine en la parcourant de son dernier à son premier caractère (l'adresse du premier caractère étant passé dans EAX, il faut tout d'abord parcourir la chaine pour trouver son dernier caractère)
-
- procedure decrypt(s: String); register;
- asm
- mov ecx, eax
- xor edx, edx
- @init:
- mov al, byte ptr [ecx]
- test al, al
- jz @loop
- inc ecx
- inc edx
- jmp @init
- @loop:
- test edx, edx
- jz @exit
- dec ecx
- not byte ptr [ecx]
- mov al, byte ptr [ecx + 1]
- xor byte ptr [ecx], al
- dec edx
- jmp @loop
- @exit:
- end;
// cette procédure crypte une chaine en la parcourant de son premier à son dernier caractère (l'adresse du premier caractère étant passé dans EAX)
procedure crypt(s: String); register;
asm
mov ecx, eax
@loop:
mov al, byte ptr [ecx]
test al, al
jz @exit
mov al, byte ptr [ecx + 1]
xor byte ptr [ecx], al
not byte ptr [ecx]
inc ecx
jmp @loop
@exit:
end;
// cette procédure crypte une chaine en la parcourant de son dernier à son premier caractère (l'adresse du premier caractère étant passé dans EAX, il faut tout d'abord parcourir la chaine pour trouver son dernier caractère)
procedure decrypt(s: String); register;
asm
mov ecx, eax
xor edx, edx
@init:
mov al, byte ptr [ecx]
test al, al
jz @loop
inc ecx
inc edx
jmp @init
@loop:
test edx, edx
jz @exit
dec ecx
not byte ptr [ecx]
mov al, byte ptr [ecx + 1]
xor byte ptr [ecx], al
dec edx
jmp @loop
@exit:
end;