Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Assembly Language

Name: Anonymous 2009-04-29 18:35

Can someone explain to me how i would go about doing this?

Let the user enter and encryption key consisting of multiple characters. Use this key to encrypt and decrypt the plain-text by XORing each character of the key against a correponding byte in the message. Repeat the key as many times a necessary untill all plain-text bytes are translated.


KEY = 239
BUFMAX = 128

.data
sPrompt  BYTE "Enter the plain text: ",0
sEncrypt BYTE "Cipher text:             ",0
sDecrypt BYTE "Decrypted:             ",0
buffer   BYTE    BUFMAX+1 DUP(0)
bufSize    DWORD    ?

.code
main PROC
    call InputTheString
    call TranslateBuffer
    mov  edx,OFFSET sEncrypt
    call DisplayMessage
    call TranslateBuffer
    mov  edx,OFFSET sDecrypt
    call DisplayMessage
    exit
main ENDP

    pushad
    mov edx,OFFSET sPrompt
    call WriteString
    mov ecx,BUFMAX
    mov edx,OFFSET buffer
    call ReadString
    mov bufSize,eax
    call Crlf
    popad
    ret
InputTheString ENDP

    pushad
    call WriteString
    mov edx, OFFSET buffer
    call WriteString
    call Crlf
    call Crlf
    popad
    ret
DisplayMessage ENDP

    pushad
    mov ecx,bufSize
    mov esi,0
L1:
    xor buffer[esi],Key
    inc esi
    loop L1
    popad
    ret

TranslateBuffer ENDP
END main


Hopefully I didn't fail to bad at life...

Name: Anonymous 2009-04-29 18:50

>>1
Hopefully I didn't fail to bad at life...
Oh yes you le did.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List