案例6数据加密程序

这是一个对数据进行加密的程序。


汇编代码:

p macro buf
  lea dx,buf
  mov ah,9
  int 21h
  endm
data segment
pp    db 0dh,0ah,'       welcome you to run this programme!$'
qq    db 0dh,0ah,'      when you input number,press enter.$'
qw    db 0dh,0ah,'6eh,52h,94h,52h,$'
qa    db 0dh,0ah,'                    $'
info1 db 0dh,0ah,0dh,'   input number:$' 
info2 db 0dh,0ah,'  output number:$'
bufa  db 20
      db ?
      db 20 dup(0)
bufb  db 20 dup(0)
buf1  db 20
      db ?
      db 20 dup(0)
buf2  db 20 dup(0)
buf3  db 20
      db ?
      db 20 dup(0)
buf4  db 20 dup(0)
data ends
stack segment
     db 100 dup(0)
stack ends
code segment
     assume ds:data,cs:code
s:  mov ax,data
    mov ds,ax
    mov ah,0
    mov al,3
    int 10h
    mov ah,0bh
    mov bh,0
    mov bl,3
    int 10h

    p   pp
    p   qq
    lea si,qw
    mov di,5
    mov dx,0405h
    mov ah,15
    int 10h
lp: mov ah,2
    inc dl
    int 10h
    mov bl,[si]
    mov cx,1
    mov ah,9
    int 10h
    inc si
    jnz lp
    p   qa
    p   qa
    p   qa
    p   info1
    lea dx,bufa
    mov ah,10
    int 21h
    lea si,bufa+1
    mov ch,0
    mov cl,[si]
    lea di,bufb
n:  mov bx,offset bufa
    mov al,0
    xlat bufa
    mov [di],al
    inc di
    loop n
    mov byte ptr [di],'$'
    p  info2
    p  bufb

    p   info1
    lea dx,buf1
    mov ah,10
    int 21h
    lea si,buf1+1
    mov ch,0
    mov cl,[si]
    lea di,buf2
n1:  mov bx,offset buf1
    mov al,2
    xlat buf1
    mov [di],al
    inc di
    loop n1
    mov byte ptr [di],'$'
    p  info2
    p  buf2

    p   info1
    lea dx,buf3
    mov ah,10
    int 21h
    lea si,buf3+1
    mov ch,0
    mov cl,[si]
    lea di,buf4
n2:  mov bx,offset buf3
    mov al,3
    xlat buf3
    mov [di],al
    inc di
    loop n2
    mov byte ptr [di],'$'
    p  info2
    p  buf4
    mov ah,4ch
    int 21h
    code ends
       end s


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值