encryption - Assembly Irvine x86 Encrypting and Decrypting with ASCII -
i'm using x86 assembly , it, need take string of 20 chars, or more, , char user. need rotate each char 2 bits , xor
ascii code.
the problem can user string , char, how loop through string? tried looping through array, crashed.
.386 .model flat,stdcall .stack 4096 exitprocess proto,dwexitcode:dword writedec proto writestring proto writechar proto crlf proto readstring proto dumpregs proto delay proto .data max = 80 ;max chars read, if input more gets cut off stringin byte max+1 dup (?) ;room null stringascii byte max+1 dup (?) ;room null charmax = 2; storedstring dword ? storedascii dword ? savedspots dword ? command byte "enter 20 word string" ,0 askforchar byte "enter char" ,0 encrypt byte "encrypted string" ,0 .code main proc mov edx , offset command ;enter 20 word string call writestring ;print call crlf ;space mov edx, offset stringin ;get address of gonna put our response mov ecx, max ;mov max value of chars call readstring ;read call crlf ;space mov edx , offset askforchar ;then ask single char call writestring ;write out call crlf ;clear line mov edx, offset stringascii ;get address of gonna put our char mov ecx, charmax ;get 1 ascii code call readstring ;double space call crlf ;double space mov edx, offset stringascii ;this test reprint our word mov storedascii, edx ; mov ecx, charmax ;get same max value call crlf mov edx , offset encrypt ;encrypted string call writestring ;print call crlf ;space mov esi,offset stringin ;get our string address mov ecx, max ;get our counter l1: mov edx, [esi] call writechar call crlf add esi, type stringin loop l1; ret main endp end main
edit: re-added loop
Comments
Post a Comment