Simple Encryption

Posts 1–2 of 2 · Page 1 of 1
Simple Encryption
I have tried to encrypt a string using xor instruction.
Code:
.model tiny

.code
org 100h

mov ah, 09h
mov dx, offset msg
int 21h

xor msg, 00011000b

mov ah, 09h
mov dx, offset msg
int 21h

mov ah,4ch
mov al,00
int 21h


.data
msg db "Hello World $"
I am using x86 asm with emu8086. It displays "Hello World Pello World". It only encrypts the first character. Why is this?
Quote Originally Posted by samlarenskoog View Post
I have tried to encrypt a string using xor instruction.
Code:
.model tiny

.code
org 100h

mov ah, 09h
mov dx, offset msg
int 21h

xor msg, 00011000b

mov ah, 09h
mov dx, offset msg
int 21h

mov ah,4ch
mov al,00
int 21h


.data
msg db "Hello World $"
I am using x86 asm with emu8086. It displays "Hello World Pello World". It only encrypts the first character. Why is this?
You need to create a loop for the XOR part.
The reason why only first character is XORed is because the xor operator only works on one byte per operation.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us