;
;  This is a simple, and lame, encryption program that I wrote. In theory (at
;  least) it could easily be modified into something useful but since I don't
;  give a fuck, do what you wish with it.
;
;  NEMENC BOB.TXT BOB.ENC
;
;  Running it again on the encrypt file will decrypt it. (the magic of XOR)
;
;  Nemesis - I am a lemming.
;
;  UUENCODED Executable Follows This Source
;

        .model tiny
        .code
         org 100h               ; It's a COM File

start:

        mov     si,81h          ; Point to Command Line

        mov     di,offset ifh
        call    getparam

        mov     di,offset of
        call    getparam

        mov     ax,3D02h        ; Open File R/W Mode
        lea     dx,ifh          ; ASCIIZ String for Name
        int     21h             ; Clique
        jc      error

        mov     inh,ax          ; Hold File Handle

        mov     cx,00100000b
        lea     dx,of           ; ASCIIZ String for Name
        mov     ah,3Ch          ; Make File
        int     21h             ; Clique
        jc      error
        mov     outh,ax         ; Hold File Handle

read:
        mov     bx,inh          ; In File Handle
        mov     cx,size buffer  ; 1000h bytes of Data to Read
        lea     dx,buffer       ; Into Buffer
        mov     ah,3Fh          ; Read File
        int     21h             ; Clique

        cmp     ax,0
        je      done            ; Jump if AX = 0

        call   encrypt

        mov     bx,outh         ; Out File Handle
        mov     cx,ax           ; ax = bytes read (to write too)
        lea     dx,buffer       ; from buffer
        mov     ah,40h          ; Write to File
        int     21h             ; Clique

        jmp     read            ; Continue Quest

done:
        mov     bx,inh          ; BX=File Handle
        mov     ah,3Eh          ; Close File
        int     21h             ; Clique
        jc      error

        mov     bx,outh         ; BX=File Handle
        mov     ah,3Eh          ; Close File
        int     21h             ; Clique
        jc      error

exit:
        int     20h             ; Terminate


error:
        push    ds
        xor     bx,bx           ; BX=0
        mov     ah,59h          ; Get Error Function
        int     21h             ; Clique
                                ; AX = Error

        mov     ah,0
	aam
	xchg	ah,al
	or	ax,'00'
        mov     errl,ax         ; Place Error Level Here
        mov     dx,offset errors
        mov     ah,09h          ; Display String
        int     21h             ; Clique
        pop     ds

        jmp     exit            ; Quit


encrypt:
        mov     si,key                 ; Our Encryption Key
        mov     bx,offset buffer       ; Where The Data Is!
        mov     cx, (size buffer+1)/2  ; # of Bytes

xor_loop:
        xor     word ptr [bx],si       ; Xor It
        inc     bx
        inc     bx
        loop    xor_loop
        ret

getparam:

ks:
        lodsb                   ; SI->AL
        cmp     al,' '          ; Space? If No Then Check If It's
        jne     getname         ; Over?
        loope   ks              ; Else Continue Quest

read_it:
        lodsb
getname:
        cmp     al,0Ah          ; end of string?
        je      done_scan       

        cmp     al,' '          ; end of operand?
        jbe     done_scan
        stosb                   ; AL->DI

        loop    read_it

done_scan:
        ret

ifh         db 76 dup (?)
of          db 76 dup (?)

key         dw 1F10h                    ; Our Encryption Key

inh         dw ?                        ; File Handle In
outh        dw ?                        ; File Handle Out

errors      db 'Returned Error Code: '
errl        dw  0
            db  0Dh,0Ah,'$'

buffer      db  4096 dup(?)              ; 4096 bytes of buffer power!

end start


--------------------------8<-----------------------------------------------
begin 644 nemenc.com
MOH$`OZ@!Z(L`O_0!Z(4`N`(]NJ@!S2%R3:-"`KD@`+KT`;0\S2%R/J-$`HL>
M0@*Y`!"Z8`*T/\TA/0``=!+H0@"+'D0"B\BZ8`*T0,TAZ]N+'D("M#[-(7(,
MBQY$`K0^S2%R`LT@'C/;M%G-(;0`U`J&X`TP,*-;`KI&`K0)S2$?Z^&+-D`"
MNV`"N0`(,3=#0^+ZPZP\('4#X?FL/`IT!SP@=@.JXO3#````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
E```````0'P````!2971U<FYE9"!%<G)O<B!#;V1E.B````T*)`T*
`
end
