Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to encrypt a given string

Posted By: Alisha Hughes     Category: Assembly Language     Views: 6974

Program to encrypt a given string.

Code for Program to encrypt a given string in Assembly Language

Data Segment
  str1 db 'string','$'
  strlen1 dw $-str1
Data Ends

Code Segment
  Assume cs:code, ds:data
  Begin:   
    mov ax, data
    mov ds, ax
    mov es, ax
    mov cx, strlen1
    add cx, -2
    lea di, str1
    mov bl, 02
    mov dl, 00h
    L1:
       mov ah, 00
       mov ax, di
       div bl
       cmp ah, 00
       je Even_encrypt       
    Odd_encrypt:
       mov dl, [di]
       add dl, 01h
       mov [di], dl
       inc di
       loop L1
    Even_encrypt:
       mov dl, [di]
       add dl, 02h
       mov [di], dl
       inc di
       loop L1
    Print:
       mov ah, 09h
       lea dx, str1
       int 21h
    Exit:
       mov ax, 4c00h
       int 21h
Code Ends
End Begin
    
  
Share: 


Didn't find what you were looking for? Find more on Program to encrypt a given string Or get search suggestion and latest updates.

Alisha Hughes
Alisha Hughes author of Program to encrypt a given string is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!