home *** CD-ROM | disk | FTP | other *** search
- ;Terminate v5.0 keygenerator
- ;Written by Cruehead as the first part of the 1999 +HCU strainer
- ;Written for MASM, but it should be fairly easy to port it to TASM
-
- .model tiny
- .386
- .stack
- .data
- info db 13,10,'Terminate v5.0 Keymaker',13,10
- db 'Written by Cruehead as a part of the 1999 +HCU strainer',13,10
- ename db 13,10,'Please enter your name : $'
- estreet db 13,10,'Please enter your address : $'
- ecity db 13,10,'Please enter city and ZIP code : $'
- ecountry db 13,10,'Please enter the name of your country : $'
- alldone db 13,10,13,10,'TERMINATE.KEY file created!',13,10,'Now copy it to your Terminate v5.0 directory and enjoy...',13,10,'$'
- thename db 51 dup (0)
- street db 51 dup (0)
- city db 51 dup (0)
- country db 51 dup (0)
- storage1 dw 0
- storage2 dw 0
- seed1 dw 0
- seed2 dw 0
- constant dw 08405h
- counter dw 0
- handle dw 0
- filename db 'TERMINAT.KEY',0
- fileinfo db 0162h*0bh dup (0)
- loopvalue dw 0
-
- include term.inc ;The magic table
-
- .code
- .startup
-
- mov ah,09h
- lea dx,info
- int 21h
-
- mov ah,0ah
- lea dx,thename
- mov thename,45
- int 21h
-
- xor bh,bh
- mov bl,thename[1]
- mov thename[bx+2],0
-
- mov ah,09h
- lea dx,estreet
- int 21h
-
- mov ah,0ah
- lea dx,street
- mov street,45
- int 21h
-
- xor bh,bh
- mov bl,street[1]
- mov street[bx+2],0
-
- mov ah,09h
- lea dx,ecity
- int 21h
-
- mov ah,0ah
- lea dx,city
- mov city,45
- int 21h
-
- xor bh,bh
- mov bl,city[1]
- mov city[bx+2],0
-
- mov ah,09h
- lea dx,ecountry
- int 21h
-
- mov ah,0ah
- lea dx,country
- mov country,45
- int 21h
-
- xor bh,bh
- mov bl,country[1]
- mov country[bx+2],0
-
- lea di,fileinfo
- lea si,thename
- add di,0481h+30
- mov al,4
-
- doitagain:
- mov cx,51
- rep movsb
-
- dec al
- cmp al,0
- jne doitagain
-
- lea di,fileinfo+481h
- mov storage1,0ffffh
- mov storage2,0ffffh
- mov loopvalue,0103h
- call checksum
-
- mov ax,storage1
- mov [di],ax
- mov ax,storage2
- mov [di+2],ax
-
- lea di,fileinfo+6e6h
- mov ax,storage1
- add ax,10
- mov [di],ax
- mov ax,storage2
- mov [di+2],ax
-
- mov seed1,7
- mov seed2,0
- mov counter,0
-
- lea di,fileinfo+481h
- call decrypt1
- lea di,fileinfo+481h
- call decrypt2
- lea di,fileinfo+481h
- mov seed1,0325ch
- mov seed2,0
- call decrypt2
- lea di,fileinfo+481h
- mov seed1,0904h
- mov seed2,033eeh
- call decrypt2
-
- lea di,fileinfo
- mov loopvalue,015eh
- mov storage1,0ffffh
- mov storage2,0ffffh
- mov counter,0
- morecrccalc:
- call checksum
- add di,4
- add loopvalue,015eh
- cmp counter,0f0ah
- jne morecrccalc
-
- lea di,fileinfo
- add di,0162h*0bh-4
- mov ax,storage1
- mov bx,storage2
- mov [di],ax
- mov [di+2],bx
-
- mov ah,03ch
- mov cx,0
- lea dx,filename
- int 21h
- mov handle,ax
-
- mov ah,040h
- mov bx,handle
- mov cx,0162h*0bh
- lea dx,fileinfo
- int 21h
-
- mov ah,03eh
- mov bx,handle
- int 21h
-
- mov ah,09h
- lea dx,alldone
- int 21h
-
- .exit
-
- decrypt1:
- mov al,[di]
- xor al,0ffh
- mov [di],al
- inc counter
- inc di
- cmp counter,0107h
- jne decrypt1
- mov counter,0
- ret
-
- decrypt2:
- call getvalue
- mov bl,es:[di]
- xor al,bl
- mov es:[di],al
- inc di
- inc counter
- cmp counter,0107h
- jne decrypt2
- mov counter,0
- ret
-
- getvalue:
- mov ax,seed1
- mov bx,seed2
- mov cx,ax
- mul constant
- shl cx,1
- shl cx,1
- shl cx,1
- add ch,cl
- add dx,cx
- add dx,bx
- shl bx,1
- shl bx,1
- add dx,bx
- add dh,bl
- mov cl,5
- shl bx,cl
- add dh,bl
- add ax,1
- adc dx,0
- mov seed1,ax
- mov seed2,dx
- xor ax,ax
- mov bx,0100h
- or bx,bx
- jz label1
- xchg ax,dx
- div bx
- xchg ax,dx
- label1:
- ret
-
- checksum:
- lea si,term
- mov cl,[di]
- mov bx,storage1
- mov dx,storage2
- xor bx,cx
- xor bh,bh
- shl bx,1
- shl bx,1
- add si,bx
- add bx,02014h
- mov ax,[si]
- mov cx,[si+2]
- mov dx,storage2
- mov bx,storage1
- push cx
- mov cx,8
- theloop:
- shr dx,1
- rcr bx,1
- loop theloop
- and dx,0ffh
- pop cx
- xor ax,bx
- mov bx,cx
- xor dx,bx
- mov storage1,ax
- mov storage2,dx
- inc counter
- inc di
- mov cx,loopvalue
- cmp counter,cx
- jne checksum
-
- cmp counter,02bch ;15eh*2 (second read)
- jne check12
- add storage1,0329h
- adc storage2,0
- check12:
- cmp counter,0f0ah ;15eh*B (11'th and last read)
- jne noproblemo
- add storage1,0192h
- adc storage2,0
-
- noproblemo:
- ret
-
- end
-