home *** CD-ROM | disk | FTP | other *** search
- ;**************************************************
- ; Procedure for coding password for NetWare
- ;**************************************************
-
- assume cs:code,ds:code
-
- code segment word public 'CODE'
-
- tabl1 db 72,147,70,103,152,61,230,141,183,16,122,38,90,185,177,53,107
- db 15,213,112,174,251,173,17,244,71,220,167,236,207,80,192
-
- tabl2 db 7,8,0,8,6,4,14,4,5,12,1,7,11,15,10,8,15,8,12,12,9,4,1,14
- db 4,6,2,4,0,10,11,9,2,15,11,1,13,2,1,9,5,14,7,0,0,2,6,6,0
- db 7,3,8,2,9,3,15,7,15,12,15,6,4,10,0,2,3,10,11,13,8,3,10,1
- db 7,12,15,1,8,9,13,9,1,9,4,14,4,12,5,5,12,8,11,2,3,9,14,7
- db 7,6,9,14,15,12,8,13,1,10,6,14,13,0,7,7,10,0,1,15,5,4,11
- db 7,11,14,12,9,5,13,1,11,13,1,3,5,13,14,6,3,0,11,11,15,3
- db 6,4,9,13,10,3,1,4,9,4,8,3,11,14,5,0,5,2,12,11,13,5,13,5
- db 13,2,13,9,10,12,10,0,11,3,5,3,6,9,5,1,14,14,0,14,8,2,13
- db 2,2,0,4,15,8,5,9,6,8,6,11,10,11,15,0,7,2,8,12,7,3,10,1
- db 4,2,5,15,7,10,12,14,5,9,3,14,7,1,2,14,1,15,4,10,6,12,6
- db 15,4,3,0,12,0,3,6,15,8,7,11,2,13,12,6,10,10,8,13
-
- ;
- ; static void Pack_32to16(char buff[],char *forc)
- ;
- Pack_32to16 proc near
- ; di -> forc
- xor al,al
- mov cx,2
- @@99:
- xor bx,bx
- @@100:
- push cx
- xor ah,ah
- mov si,ax
- add si,bx
- and si,01Fh
- mov dl,buff[si]
- sub dl,tabl1[bx]
- mov cl,buff[bx]
- add cx,ax
- xor cx,dx
- add ax,cx
- mov buff[bx],cl
- pop cx
- inc bx
- cmp bx,32
- jl @@100
- loop @@99
-
- push di
- mov cx,8
- xor ax,ax
- rep stosw
- pop di
-
- xor si,si
- @@101:
- mov al,buff[si]
- xor ah,ah
- mov bx,ax
- mov al,tabl2[bx]
- mov bx,si
- shr bx,1
- jnc @@102
- mov cl,4
- shl ax,cl
- @@102:
- or [di+bx],al
- inc si
- cmp si,32
- jl @@101
- ret
- Pack_32to16 endp
-
- ; void CodePassword(long ID,char *password, int len, char *forcode)
-
- public CodePassword
- CodePassword proc near
- ; si -> password
- ; cx - len
- ; di -> forcode
- push di
- push si
- mov si,offset ask
- mov di,offset reply
- mov ah,0E3h
- int 21h
- pop si
-
- mov di,si
- add si,cx
- dec si
- std
- @@1:
- lodsb
- or al,al
- jne @@2
- loop @@1
- @@2:
- push di
- mov di,offset buff
- push cx
- mov cx,16
- xor ax,ax
- cld
- rep stosw
- pop cx
- pop di
- @@3:
- cmp cx,32
- jbe @@5
- push cx
- mov cx,32
- mov bx,offset buff
- mov si,di
- @@4:
- lodsb
- xor [bx],al
- inc bx
- loop @@4
- pop cx
- mov di,si
- sub cx,32
- jmp @@3
- @@5:
- or cx,cx
- jle short @@9
- cld
- xor bx,bx
- mov si,di
- @@6:
- push di
- add di,cx
- cmp si,di
- pop di
- jne @@7
- mov si,di
- mov al,tabl1[bx]
- xor buff[bx],al
- jmp short @@8
- @@7:
- lodsb
- xor buff[bx],al
- @@8:
- inc bx
- cmp bx,32
- jl @@6
- @@9:
- xor bx,bx
- @@10:
- push bx
- and bx,3
- mov al,ID[bx]
- pop bx
- xor buff[bx],al
- inc bx
- cmp bx,32
- jl @@10
- pop di
- call Pack_32to16
- ret
- CodePassword endp
- ask dw 11
- db 35h
- db 0,1
- db 7
- db 'NEWUSER'
-
- reply dw 54
- ID db 0,0,0,0
- buff db 50 dup(0)
-
- code ends
- end