-
Notifications
You must be signed in to change notification settings - Fork 0
/
vigenere.asz~
65 lines (59 loc) · 1.14 KB
/
vigenere.asz~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
%include "io.mac"
section .bss
plaintext_len: resd 1
key_len: resd 1
section .text
global vigenere
extern printf
vigenere:
;; DO NOT MODIFY
push ebp
mov ebp, esp
pusha
mov edx, [ebp + 8] ; ciphertext
mov esi, [ebp + 12] ; plaintext
mov ecx, [ebp + 16] ; plaintext_len
mov edi, [ebp + 20] ; key
mov ebx, [ebp + 24] ; key_len
;; DO NOT MODIFY
;; TODO: Implement the Vigenere cipher
mov [plaintext_len], ecx
mov [key_len], ebx
;; TODO: implementare folosind while pentru parcurgerea plaintext
xor ecx, ecx
xor eax, eax
xor ebx, ebx
criptare:
cmp ebx, [key_len]
jge actualizare_ebx
back:
mov al, byte[esi + ecx]
mov ah, byte[edi + ebx]
cmp al, 'A'
jl non_char
cmp al, 'Z'
jle found
cmp al, 'a'
jl non_char
cmp al, 'z'
jg non_char
;;TODO gasit litera mica
jmp end
found: ;; TODO: gasit litera mare
jmp end
non_char:
mov byte[edx + ecx], al
end:
inc ebx
inc ecx
cmp ecx, [plaintext_len]
jle criptare
;; End Vigenere Cipher
;; DO NOT MODIFY
popa
leave
ret
actualizare_ebx:
xor ebx, ebx
jmp back
;; DO NOT MODIFY