Program in Assembly Language to encrypt the password in Strings

A program written in assembly language comprises of a progression of memory helper processor guidelines and meta-proclamations (referred to differently as orders, pseudo-directions and pseudo-operations), remarks and information. Assembly language guidelines as a rule comprise of an opcode mental helper pursued by a rundown of information, contentions or parameters. These are made an interpretation of by a constructing agent into machine language directions that can be stacked into memory and executed..Code of the encryption of password in assembly language is given below.

.386
.model flat
.stack 1024
.data

password byte “mypassword”,0
encrypted byte lengthof password dup (?)
decrypted byte lengthof password dup (?)
key byte 32h

.code

encrypt proc uses eax esi edi
startwhile:
cmp byte ptr [esi] , 0
je endwhile
mov al , [esi]
xor al , key
mov [edi],al
inc esi
inc edi
jmp startwhile
endwhile:
ret
encrypt endp

decrypt proc uses eax esi edi
startwhile:
cmp byte ptr [esi] , 0
je endwhile
mov al , [esi]
xor al , key
mov [edi],al
inc esi
inc edi
jmp startwhile
endwhile:
ret
decrypt endp

main proc

mov esi , offset password
mov edi , offset encrypted
call encrypt

mov esi , offset encrypted
mov edi , offset decrypted
call decrypt

mov ebx , 0
main endp

end main

Comment if have any confusion or queries. Thanks !!!

Add a Comment

Your email address will not be published. Required fields are marked *