📄 gcbjm_hd.asm
字号:
;***********************************************************
;*GCBJM_HD.ASM 自编加密模块 *
;***********************************************************
code segment
assume cs:code,ds:code,es:code
org 100h
start:
jmp begin
msg0 db 13,10
db 'COM-SECURE FOR HDISK V1.0 ',13,10
db ' Copyright(c) 1993.11 GongCheng-Bing By SiChuan RanLiao Chang.',13,10
cr db 13,10,'$'
msg1 db 'Please input filename: $'
msg2 db 13,10,'The Key Disk Not Found !',13,10,'$'
msg4 db 7,'File not found!',13,10,'$'
msg5 db 7,'Invalid filename !',13,10,'$'
msg8 db 13,10,'FILE SECURE OK !!',13,10,13,10,'$'
fname1 db 128 dup (0)
;fname1 db 'GCBJM_HD.OVL',0 ;加密附加模块文件名
handle1 dw 0
fname2 db 'HDGCBHHL.SEC',0 ;生成加密文件名
handle2 dw 0
Fname db 64,?,64 dup (?) ;需要加密的文件名
handle dw 0
attrib dw ? ;文件属性
Time dw ? ;文件时间
Date dw ? ;
key dw 9b4fh ; 7955h
begin:
mov si,2ch
mov ds,[si]
xor si,si
bbb1:
lodsb
cmp al,0
jnz bbb1
cmp word ptr [si],0100h
jnz bbb1
cmp byte ptr [si+2],0
jnz bbb1
add si,3
mov cx,si
bbb2:
lodsb
cmp al,0
jnz bbb2
sub si,cx
xchg cx,si
mov di,offset fname1
repz movsb
push cs
pop ds
bbb3:
dec di
cmp byte ptr ds:[di],'.'
jnz bbb3
mov word ptr [di+1],'VO'
mov byte ptr [di+3],'L'
mov dx,offset msg0
mov ah,9
int 21h
cmp byte ptr cs:[80h],2
jb loc_01
mov si,82h
jmp loc_02
loc_01:
mov dx,offset msg1
mov ah,9
int 21h
mov dx,offset fname
mov ah,0ah
int 21h
mov dx,offset cr
mov ah,9
int 21h
mov si,offset fname+2
loc_02:
mov di,offset fname
cld
b1:
lodsb
cmp al,0dh
je b2
cmp al,20h
je b1
cmp al,'a'
jb b119
cmp al,'z'
ja b119
sub al,20h
b119:
stosb
jmp b1
b2:
xor al,al
stosb
push ds
mov bx,KEY ;use_bx
mov ax,0ff00h
mov ds,ax
xor si,si
mov cx,7f8h
gloc_1:
lodsw
xchg ah,al
add bx,ax
loop gloc_1
pop ds
mov key,bx
bbbb2:
mov dx,offset fname1
mov ax,3d00h
int 21h
jnc b8
exit:
mov dx,offset msg4
mov ah,9
int 21h
mov ax,4c02h
int 21h
b8:
mov handle1,ax
mov dx,offset fname
mov ax,3d00h
int 21h
jc exit
mov handle,ax
mov ah,3ch
mov dx,offset fname2
mov cx,0
int 21h
jc exit
mov handle2,ax
mov ax,4202h
mov cx,0
mov dx,0
mov bx,handle1
INT 21H
push ax
mov ax,4200h
mov cx,0
mov dx,0
int 21h
pop cx
mov ah,3fh
mov dx,offset buff
int 21h
mov ah,3eh
int 21h
mov bx,handle2
mov ah,40h
int 21h
mov ax,4202h
mov bx,handle
mov cx,0
mov dx,0
int 21h
push ax
inc ax
shr ax,1
mov word ptr buff,ax
mov ax,4200h
mov bx,handle2
mov cx,0
mov dx,0feh
int 21h
mov ah,40h
mov cx,2
mov dx,offset buff
int 21h
mov ax,4202h
mov cx,0
mov dx,0
int 21h
mov ax,4200h
mov bx,handle
mov cx,0
mov dx,0
int 21h
pop cx
mov ah,3fh
mov dx,offset buff
int 21h
mov ah,3eh
int 21h
inc cx
and cx,0fffeh
push cx
mov bx,key
inc cx
shr cx,1
mov dx,9876h
mov si,offset buff
mov di,offset buff
gloc_2:
lodsw
add ax,dx
xchg ah,al
xor ax,dx
add ax,bx
xchg ah,al
xor ax,bx
add bx,3
sub dx,2
stosw
loop gloc_2
mov bx,handle2
mov dx,offset buff
mov ah,40h
pop cx
int 21h
mov ah,3eh
int 21h
mov ah,9
mov dx,offset msg8
int 21h
mov ax,4c00h
int 21h
buff label byte
code ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -