; Author can be email at: stone@one.se ;>

; Btw - this was formated by DarkStalker's ASMFMT - thanks DS :)

.model SMALL

.stack 100h

.386



.DATA         

input    DB 39,0

uname    DB 39 dup (20h) 

valid    DB 10,13,'A valid key is: '

realkey  DB 8 dup (30h)

strend   DB '$'

introtxt DB '           WinDates 3.0  *Keymaker*      ',10,13

         DB 'ؤؤؤؤؤؤؤؤؤؤؤؤؤؤ|   STONE   |ؤؤؤؤؤؤؤؤؤؤؤؤؤؤ',10,13

         DB '  ـــ   ـــ    ـــــــــ    ـــــــــ    ',10,13

         DB '  غغغ   غغغ    غغغ          غغغـــ       ',10,13

         DB '  غغغـ  غغغ    غغغـ         غغغ          ',10,13

         DB '  ككككككككك    ككككككككك    ككك          ',10,13

         DB 'ؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤ',10,13

         DB 'u N I T E D  c R ’ C K I N G  f O R C E  ',10,13

         DB '[wIN95/NT]ؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤ[oCT 1997]',10,13

         DB 'Enter your username: ','$'



         DB '2nd&mi' ; Personal tag - not used



.CODE

	MOV AX, @DATA			; Make DS&ES point to the DATA

	MOV DS, AX

	MOV ES, AX



	LEA EDX, [introtxt]		; Write intro text 

	MOV AH, 9h

	INT 21h



	MOV AX, 0A00h                  

	LEA EDX, [input]

	INT 21h				; Get buffered input



	MOVZX EBX, BYTE PTR [input+1]	; Get length

	CMP EBX, 0		     	; Did he type anything?

	JZ  EXIT

	MOV BYTE PTR [EBX+input+2],20h  ; If he did erradicate 0dh termination



	CALL genkey			; Generate the key





	LEA EDX, [valid]		; write the key

	MOV AH, 09h

	INT 21h



EXIT:

	MOV AX,4C00h			; Exit, error code = 0

	INT 21h





genkey PROC

	XOR ESI, ESI			; Reset ESI (A counter)

nextbyte:  

	MOV EAX, ESI			

	AND EAX, 01h

	NEG EAX

	SBB EAX, EAX

	AND EAX, 02

	DEC EAX

	MOVSX EDX, BYTE PTR [ESI+uname]

	MOV ECX, 0Ah

	IMUL EAX, ESI			; EAX=EAX*ESI

	LEA EAX, [EAX*2+EDX]		; EAX=2*EAX+"Username byte" 

	CDQ					

	IDIV ECX			; Div 10

	ADD BYTE PTR [ESI+realkey],DL	; division leftover= key

	INC ESI

	CMP ESI,08			; only 8 bytes matters

	JL  nextbyte

	RET

genkey ENDP



END