RC6加密解密算法(MD5)

c5soft

端茶倒水的
管理成员
Administrator
Registered
Moderator
Life Time Member
VIP Member
GUEST, unregistred user!
注册
2015-06-01
消息
132
代码:
{**********}
{          }
{       RC6加密解密算法(MD5)          }
{          }
{       版权所有 (C) 2011 QQ:9844201          }
{          }
{**********}
unit RC6Dcrypt;

interface
   uses
     SysUtils;
    
{----------
  过程名:    RC6Encode
  作者:      YCJ
  日期:      2011.09.08
  参数:      const InData; var OutData; Size:Cardinal; Key:PAnsiChar
  返回值:    无
  用途: 加密内存流
  Key 为PAnsiChar 类型
  OutData 要预先分配好内存
----------}
procedure RC6Encode(const InData; var OutData; Size:Cardinal; Key:PAnsiChar);

{----------
  过程名:    RC6Encode
  作者:      YCJ
  日期:      2011.09.08
  参数:      const InData; var OutData; Size:Cardinal; Key:PAnsiChar
  返回值:    无
  用途: 解密内存流
  Key 为PAnsiChar 类型
  OutData 要预先分配好内存
----------}
procedure RC6Decode(const InData; var OutData; Size:Cardinal; Key:PAnsiChar);
implementation

const
  OPCODE:Array [0..4515] of Byte =
  (
    $55,$8B,$EC,$81,$C4,$10,$FF,$FF,$FF,$53,$56,$57,$8B,$5D,$14,$8B,
    $7D,$10,$8D,$75,$F4,$E8,$00,$00,$00,$00,$58,$2D,$1A,$3D,$45,$00,
    $50,$8F,$45,$FC,$B8,$C8,$4C,$45,$00,$03,$45,$FC,$89,$45,$F0,$8B,
    $45,$08,$89,$45,$F8,$8B,$45,$0C,$89,$06,$8B,$45,$F0,$83,$C0,$5C,
    $B1,$FF,$BA,$B0,$00,$00,$00,$E8,$8C,$05,$00,$00,$8D,$45,$E0,$B1,
    $FF,$BA,$10,$00,$00,$00,$E8,$7D,$05,$00,$00,$8D,$85,$10,$FF,$FF,
    $FF,$33,$C9,$BA,$40,$00,$00,$00,$E8,$6B,$05,$00,$00,$8D,$85,$50,
    $FF,$FF,$FF,$33,$C9,$BA,$80,$00,$00,$00,$E8,$59,$05,$00,$00,$8B,
    $C3,$E8,$2A,$0F,$00,$00,$8B,$C8,$8D,$85,$50,$FF,$FF,$FF,$8B,$D3,
    $E8,$13,$0F,$00,$00,$8B,$45,$F0,$E8,$57,$05,$00,$00,$8D,$85,$50,
    $FF,$FF,$FF,$8B,$4D,$F0,$BA,$80,$00,$00,$00,$E8,$7C,$0E,$00,$00,
    $8D,$95,$10,$FF,$FF,$FF,$8B,$45,$F0,$E8,$92,$05,$00,$00,$8D,$85,
    $10,$FF,$FF,$FF,$8B,$4D,$F0,$BA,$40,$00,$00,$00,$E8,$47,$01,$00,
    $00,$8D,$85,$10,$FF,$FF,$FF,$33,$C9,$BA,$40,$00,$00,$00,$E8,$F5,
    $04,$00,$00,$80,$7D,$18,$00,$0F,$84,$8D,$00,$00,$00,$8B,$DF,$C1,
    $EB,$04,$85,$DB,$76,$4C,$8B,$16,$8B,$45,$F8,$B9,$10,$00,$00,$00,
    $E8,$77,$04,$00,$00,$8D,$55,$E0,$8B,$06,$B9,$10,$00,$00,$00,$E8,
    $14,$04,$00,$00,$8B,$06,$8B,$D0,$8B,$4D,$F0,$E8,$E8,$01,$00,$00,
    $8D,$55,$E0,$8B,$06,$B9,$10,$00,$00,$00,$E8,$4D,$04,$00,$00,$8B,
    $45,$F8,$83,$C0,$10,$89,$45,$F8,$8B,$06,$83,$C0,$10,$89,$06,$4B,
    $75,$B4,$8B,$DF,$83,$E3,$0F,$85,$DB,$0F,$84,$C0,$00,$00,$00,$8D,
    $55,$E0,$8D,$45,$E0,$8B,$4D,$F0,$E8,$AB,$01,$00,$00,$8B,$CB,$8B,
    $16,$8B,$45,$F8,$E8,$13,$04,$00,$00,$8B,$CB,$8D,$55,$E0,$8B,$06,
    $E8,$B3,$03,$00,$00,$E9,$95,$00,$00,$00,$8B,$DF,$C1,$EB,$04,$85,
    $DB,$76,$5D,$8B,$16,$8B,$45,$F8,$B9,$10,$00,$00,$00,$E8,$EA,$03,
    $00,$00,$8D,$55,$D0,$8B,$45,$F8,$B9,$10,$00,$00,$00,$E8,$DA,$03,
    $00,$00,$8B,$06,$8B,$D0,$8B,$4D,$F0,$E8,$6E,$02,$00,$00,$8D,$55,
    $E0,$8B,$06,$B9,$10,$00,$00,$00,$E8,$6B,$03,$00,$00,$8D,$55,$E0,
    $8D,$45,$D0,$B9,$10,$00,$00,$00,$E8,$AF,$03,$00,$00,$8B,$45,$F8,
    $83,$C0,$10,$89,$45,$F8,$8B,$06,$83,$C0,$10,$89,$06,$4B,$75,$A3,
    $8B,$DF,$83,$E3,$0F,$85,$DB,$74,$26,$8D,$55,$E0,$8D,$45,$E0,$8B,
    $4D,$F0,$E8,$11,$01,$00,$00,$8B,$CB,$8B,$16,$8B,$45,$F8,$E8,$79,
    $03,$00,$00,$8B,$CB,$8D,$55,$E0,$8B,$06,$E8,$19,$03,$00,$00,$5F,
    $5E,$5B,$8B,$E5,$5D,$C2,$14,$00,$53,$56,$57,$55,$81,$C4,$F4,$FE,
    $FF,$FF,$89,$0C,$24,$8B,$DA,$8B,$F0,$8D,$44,$24,$0C,$33,$C9,$BA,
    $00,$01,$00,$00,$E8,$9F,$03,$00,$00,$8D,$54,$24,$0C,$8B,$C6,$8B,
    $CB,$E8,$36,$03,$00,$00,$8B,$C3,$C1,$E8,$02,$89,$44,$24,$04,$83,
    $E3,$03,$85,$DB,$74,$04,$FF,$44,$24,$04,$8B,$04,$24,$8D,$50,$5C,
    $8B,$04,$24,$05,$0C,$01,$00,$00,$B9,$B0,$00,$00,$00,$E8,$0A,$03,
    $00,$00,$33,$FF,$33,$ED,$33,$DB,$33,$F6,$83,$7C,$24,$04,$2C,$76,
    $09,$8B,$44,$24,$04,$8D,$04,$40,$EB,$05,$B8,$84,$00,$00,$00,$85,
    $C0,$76,$57,$89,$44,$24,$08,$8B,$04,$24,$8B,$44,$B8,$5C,$03,$C3,
    $03,$C6,$BA,$03,$00,$00,$00,$E8,$A0,$02,$00,$00,$8B,$D8,$8B,$04,
    $24,$89,$5C,$B8,$5C,$8D,$14,$1E,$8B,$44,$AC,$0C,$03,$C3,$03,$C6,
    $E8,$87,$02,$00,$00,$8B,$F0,$89,$74,$AC,$0C,$8D,$47,$01,$B9,$2C,
    $00,$00,$00,$33,$D2,$F7,$F1,$8B,$FA,$8D,$45,$01,$33,$D2,$F7,$74,
    $24,$04,$8B,$EA,$FF,$4C,$24,$08,$75,$AD,$8D,$44,$24,$0C,$33,$C9,
    $BA,$00,$01,$00,$00,$E8,$DE,$02,$00,$00,$81,$C4,$0C,$01,$00,$00,
    $5D,$5F,$5E,$5B,$C3,$8D,$40,$00,$53,$56,$57,$55,$83,$C4,$E8,$89,
    $4C,$24,$08,$89,$54,$24,$04,$89,$04,$24,$8B,$14,$24,$8B,$32,$8B,
    $04,$24,$8B,$C2,$8B,$D0,$83,$C2,$04,$8B,$3A,$8B,$14,$24,$8B,$D0,
    $83,$C2,$08,$8B,$2A,$8B,$14,$24,$83,$C0,$0C,$8B,$00,$89,$44,$24,
    $0C,$8B,$44,$24,$08,$03,$78,$5C,$8B,$44,$24,$08,$8B,$40,$60,$01,
    $44,$24,$0C,$C7,$44,$24,$14,$01,$00,$00,$00,$8B,$C7,$03,$C0,$40,
    $F7,$EF,$BA,$05,$00,$00,$00,$E8,$E0,$01,$00,$00,$8B,$D8,$8B,$44,
    $24,$0C,$03,$C0,$40,$F7,$6C,$24,$0C,$BA,$05,$00,$00,$00,$E8,$C9,
    $01,$00,$00,$89,$44,$24,$10,$8B,$C3,$33,$C6,$8B,$54,$24,$10,$E8,
    $B8,$01,$00,$00,$8B,$54,$24,$14,$03,$D2,$8B,$4C,$24,$08,$03,$44,
    $91,$5C,$8B,$F0,$8B,$44,$24,$10,$33,$C5,$8B,$D3,$E8,$9B,$01,$00,
    $00,$8B,$54,$24,$14,$03,$D2,$8B,$4C,$24,$08,$03,$44,$91,$60,$8B,
    $E8,$8B,$DE,$8B,$F7,$8B,$FD,$8B,$6C,$24,$0C,$89,$5C,$24,$0C,$FF,
    $44,$24,$14,$83,$7C,$24,$14,$15,$75,$81,$8B,$44,$24,$08,$03,$B0,
    $04,$01,$00,$00,$8B,$44,$24,$08,$03,$A8,$08,$01,$00,$00,$8B,$44,
    $24,$04,$89,$30,$8B,$44,$24,$04,$83,$C0,$04,$89,$38,$8B,$44,$24,
    $04,$83,$C0,$08,$89,$28,$8B,$44,$24,$04,$83,$C0,$0C,$8B,$54,$24,
    $0C,$89,$10,$83,$C4,$18,$5D,$5F,$5E,$5B,$C3,$90,$53,$56,$57,$55,
    $83,$C4,$EC,$89,$4C,$24,$04,$89,$14,$24,$8B,$C8,$8B,$31,$8B,$D1,
    $8B,$CA,$83,$C1,$04,$8B,$39,$8B,$CA,$83,$C1,$08,$8B,$29,$83,$C2,
    $0C,$8B,$02,$89,$44,$24,$08,$8B,$44,$24,$04,$2B,$A8,$08,$01,$00,
    $00,$8B,$44,$24,$04,$2B,$B0,$04,$01,$00,$00,$C7,$44,$24,$10,$14,
    $00,$00,$00,$8B,$DE,$8B,$74,$24,$08,$89,$6C,$24,$08,$8B,$EF,$8B,
    $FB,$8B,$44,$24,$08,$03,$C0,$40,$F7,$6C,$24,$08,$BA,$05,$00,$00,
    $00,$E8,$C6,$00,$00,$00,$89,$44,$24,$0C,$8B,$C7,$03,$C0,$40,$F7,
    $EF,$BA,$05,$00,$00,$00,$E8,$B1,$00,$00,$00,$8B,$D8,$8B,$44,$24,
    $10,$03,$C0,$8B,$54,$24,$04,$FF,$74,$82,$60,$8B,$C5,$5A,$2B,$C2,
    $8B,$D3,$E8,$AD,$00,$00,$00,$33,$44,$24,$0C,$8B,$E8,$8B,$44,$24,
    $10,$03,$C0,$8B,$54,$24,$04,$FF,$74,$82,$5C,$8B,$C6,$5A,$2B,$C2,
    $8B,$54,$24,$0C,$E8,$8B,$00,$00,$00,$33,$D8,$8B,$F3,$FF,$4C,$24,
    $10,$83,$7C,$24,$10,$00,$0F,$85,$77,$FF,$FF,$FF,$8B,$44,$24,$04,
    $8B,$40,$60,$29,$44,$24,$08,$8B,$44,$24,$04,$2B,$78,$5C,$8B,$04,
    $24,$89,$30,$8B,$04,$24,$83,$C0,$04,$89,$38,$8B,$04,$24,$83,$C0,
    $08,$89,$28,$8B,$04,$24,$83,$C0,$0C,$8B,$54,$24,$08,$89,$10,$83,
    $C4,$14,$5D,$5F,$5E,$5B,$C3,$90,$53,$56,$57,$8B,$F1,$85,$F6,$76,
    $17,$B9,$01,$00,$00,$00,$8B,$DA,$03,$D9,$4B,$8A,$1B,$8B,$F8,$03,
    $F9,$4F,$30,$1F,$41,$4E,$75,$EE,$5F,$5E,$5B,$C3,$53,$8B,$CA,$8B,
    $D8,$D3,$E3,$B9,$20,$00,$00,$00,$2B,$CA,$D3,$E8,$0B,$D8,$8B,$C3,
    $5B,$C3,$8B,$C0,$53,$8B,$CA,$8B,$D8,$D3,$EB,$B9,$20,$00,$00,$00,
    $2B,$CA,$D3,$E0,$0B,$D8,$8B,$C3,$5B,$C3,$8B,$C0,$53,$83,$C4,$F8,
    $89,$04,$24,$89,$54,$24,$04,$8B,$04,$24,$3B,$44,$24,$04,$74,$41,
    $8B,$44,$24,$04,$3B,$04,$24,$76,$1D,$8B,$C1,$48,$83,$F8,$00,$7C,
    $30,$8B,$14,$24,$8A,$14,$02,$8B,$4C,$24,$04,$88,$14,$01,$48,$83,
    $F8,$FF,$75,$ED,$EB,$1B,$8B,$D1,$4A,$85,$D2,$7C,$14,$42,$33,$C0,
    $8B,$0C,$24,$8A,$0C,$01,$8B,$5C,$24,$04,$88,$0C,$03,$40,$4A,$75,
    $EF,$59,$5A,$5B,$C3,$8D,$40,$00,$51,$89,$04,$24,$8B,$C2,$48,$83,
    $F8,$00,$7C,$0C,$8B,$14,$24,$88,$0C,$02,$48,$83,$F8,$FF,$75,$F4,
    $5A,$C3,$8B,$C0,$53,$8B,$D8,$8B,$C3,$E8,$1E,$00,$00,$00,$C7,$43,
    $0C,$01,$23,$45,$67,$C7,$43,$10,$89,$AB,$CD,$EF,$C7,$43,$14,$FE,
    $DC,$BA,$98,$C7,$43,$18,$76,$54,$32,$10,$5B,$C3,$53,$8B,$D8,$33,
    $C0,$89,$03,$33,$C0,$89,$43,$04,$33,$C0,$89,$43,$08,$8D,$43,$1C,
    $33,$C9,$BA,$40,$00,$00,$00,$E8,$9C,$FF,$FF,$FF,$8D,$43,$0C,$33,
    $C9,$BA,$10,$00,$00,$00,$E8,$8D,$FF,$FF,$FF,$5B,$C3,$8D,$40,$00,
    $53,$56,$8B,$F2,$8B,$D8,$8B,$43,$08,$C6,$44,$03,$1C,$80,$83,$7B,
    $08,$38,$72,$07,$8B,$C3,$E8,$31,$00,$00,$00,$8D,$43,$54,$8B,$53,
    $04,$89,$10,$8D,$43,$58,$8B,$13,$89,$10,$8B,$C3,$E8,$1B,$00,$00,
    $00,$8B,$D6,$8D,$43,$0C,$B9,$10,$00,$00,$00,$E8,$EC,$FE,$FF,$FF,
    $8B,$C3,$E8,$85,$FF,$FF,$FF,$5E,$5B,$C3,$8B,$C0,$53,$56,$57,$55,
    $83,$C4,$BC,$89,$04,$24,$8D,$54,$24,$04,$8B,$04,$24,$83,$C0,$1C,
    $B9,$40,$00,$00,$00,$E8,$C2,$FE,$FF,$FF,$8B,$04,$24,$8B,$58,$0C,
    $8B,$04,$24,$8B,$70,$10,$8B,$04,$24,$8B,$78,$14,$8B,$04,$24,$8B,
    $68,$18,$8B,$C5,$33,$C7,$23,$C6,$33,$C5,$03,$C3,$03,$44,$24,$04,
    $05,$78,$A4,$6A,$D7,$BA,$07,$00,$00,$00,$E8,$5D,$FE,$FF,$FF,$03,
    $C6,$8B,$D8,$8B,$C7,$33,$C6,$23,$C3,$33,$C7,$03,$C5,$03,$44,$24,
    $08,$05,$56,$B7,$C7,$E8,$BA,$0C,$00,$00,$00,$E8,$3C,$FE,$FF,$FF,
    $03,$C3,$8B,$E8,$8B,$C6,$33,$C3,$23,$C5,$33,$C6,$03,$C7,$03,$44,
    $24,$0C,$05,$DB,$70,$20,$24,$BA,$11,$00,$00,$00,$E8,$1B,$FE,$FF,
    $FF,$03,$C5,$8B,$F8,$8B,$C3,$33,$C5,$23,$C7,$33,$C3,$03,$C6,$03,
    $44,$24,$10,$05,$EE,$CE,$BD,$C1,$BA,$16,$00,$00,$00,$E8,$FA,$FD,
    $FF,$FF,$03,$C7,$8B,$F0,$8B,$C5,$33,$C7,$23,$C6,$33,$C5,$03,$C3,
    $03,$44,$24,$14,$05,$AF,$0F,$7C,$F5,$BA,$07,$00,$00,$00,$E8,$D9,
    $FD,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C7,$33,$C6,$23,$C3,$33,$C7,$03,
    $C5,$03,$44,$24,$18,$05,$2A,$C6,$87,$47,$BA,$0C,$00,$00,$00,$E8,
    $B8,$FD,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C6,$33,$C3,$23,$C5,$33,$C6,
    $03,$C7,$03,$44,$24,$1C,$05,$13,$46,$30,$A8,$BA,$11,$00,$00,$00,
    $E8,$97,$FD,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C3,$33,$C5,$23,$C7,$33,
    $C3,$03,$C6,$03,$44,$24,$20,$05,$01,$95,$46,$FD,$BA,$16,$00,$00,
    $00,$E8,$76,$FD,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C5,$33,$C7,$23,$C6,
    $33,$C5,$03,$C3,$03,$44,$24,$24,$05,$D8,$98,$80,$69,$BA,$07,$00,
    $00,$00,$E8,$55,$FD,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C7,$33,$C6,$23,
    $C3,$33,$C7,$03,$C5,$03,$44,$24,$28,$05,$AF,$F7,$44,$8B,$BA,$0C,
    $00,$00,$00,$E8,$34,$FD,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C6,$33,$C3,
    $23,$C5,$33,$C6,$03,$C7,$03,$44,$24,$2C,$05,$B1,$5B,$FF,$FF,$BA,
    $11,$00,$00,$00,$E8,$13,$FD,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C3,$33,
    $C5,$23,$C7,$33,$C3,$03,$C6,$03,$44,$24,$30,$05,$BE,$D7,$5C,$89,
    $BA,$16,$00,$00,$00,$E8,$F2,$FC,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C5,
    $33,$C7,$23,$C6,$33,$C5,$03,$C3,$03,$44,$24,$34,$05,$22,$11,$90,
    $6B,$BA,$07,$00,$00,$00,$E8,$D1,$FC,$FF,$FF,$03,$C6,$8B,$D8,$8B,
    $C7,$33,$C6,$23,$C3,$33,$C7,$03,$C5,$03,$44,$24,$38,$05,$93,$71,
    $98,$FD,$BA,$0C,$00,$00,$00,$E8,$B0,$FC,$FF,$FF,$03,$C3,$8B,$E8,
    $8B,$C6,$33,$C3,$23,$C5,$33,$C6,$03,$C7,$03,$44,$24,$3C,$05,$8E,
    $43,$79,$A6,$BA,$11,$00,$00,$00,$E8,$8F,$FC,$FF,$FF,$03,$C5,$8B,
    $F8,$8B,$C3,$33,$C5,$23,$C7,$33,$C3,$03,$C6,$03,$44,$24,$40,$05,
    $21,$08,$B4,$49,$BA,$16,$00,$00,$00,$E8,$6E,$FC,$FF,$FF,$03,$C7,
    $8B,$F0,$8B,$C7,$33,$C6,$23,$C5,$33,$C7,$03,$C3,$03,$44,$24,$08,
    $05,$62,$25,$1E,$F6,$BA,$05,$00,$00,$00,$E8,$4D,$FC,$FF,$FF,$03,
    $C6,$8B,$D8,$8B,$C6,$33,$C3,$23,$C7,$33,$C6,$03,$C5,$03,$44,$24,
    $1C,$05,$40,$B3,$40,$C0,$BA,$09,$00,$00,$00,$E8,$2C,$FC,$FF,$FF,
    $03,$C3,$8B,$E8,$8B,$C3,$33,$C5,$23,$C6,$33,$C3,$03,$C7,$03,$44,
    $24,$30,$05,$51,$5A,$5E,$26,$BA,$0E,$00,$00,$00,$E8,$0B,$FC,$FF,
    $FF,$03,$C5,$8B,$F8,$8B,$C5,$33,$C7,$23,$C3,$33,$C5,$03,$C6,$03,
    $44,$24,$04,$05,$AA,$C7,$B6,$E9,$BA,$14,$00,$00,$00,$E8,$EA,$FB,
    $FF,$FF,$03,$C7,$8B,$F0,$8B,$C7,$33,$C6,$23,$C5,$33,$C7,$03,$C3,
    $03,$44,$24,$18,$05,$5D,$10,$2F,$D6,$BA,$05,$00,$00,$00,$E8,$C9,
    $FB,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C6,$33,$C3,$23,$C7,$33,$C6,$03,
    $C5,$03,$44,$24,$2C,$05,$53,$14,$44,$02,$BA,$09,$00,$00,$00,$E8,
    $A8,$FB,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C3,$33,$C5,$23,$C6,$33,$C3,
    $03,$C7,$03,$44,$24,$40,$05,$81,$E6,$A1,$D8,$BA,$0E,$00,$00,$00,
    $E8,$87,$FB,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C5,$33,$C7,$23,$C3,$33,
    $C5,$03,$C6,$03,$44,$24,$14,$05,$C8,$FB,$D3,$E7,$BA,$14,$00,$00,
    $00,$E8,$66,$FB,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C7,$33,$C6,$23,$C5,
    $33,$C7,$03,$C3,$03,$44,$24,$28,$05,$E6,$CD,$E1,$21,$BA,$05,$00,
    $00,$00,$E8,$45,$FB,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C6,$33,$C3,$23,
    $C7,$33,$C6,$03,$C5,$03,$44,$24,$3C,$05,$D6,$07,$37,$C3,$BA,$09,
    $00,$00,$00,$E8,$24,$FB,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C3,$33,$C5,
    $23,$C6,$33,$C3,$03,$C7,$03,$44,$24,$10,$05,$87,$0D,$D5,$F4,$BA,
    $0E,$00,$00,$00,$E8,$03,$FB,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C5,$33,
    $C7,$23,$C3,$33,$C5,$03,$C6,$03,$44,$24,$24,$05,$ED,$14,$5A,$45,
    $BA,$14,$00,$00,$00,$E8,$E2,$FA,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C7,
    $33,$C6,$23,$C5,$33,$C7,$03,$C3,$03,$44,$24,$38,$05,$05,$E9,$E3,
    $A9,$BA,$05,$00,$00,$00,$E8,$C1,$FA,$FF,$FF,$03,$C6,$8B,$D8,$8B,
    $C6,$33,$C3,$23,$C7,$33,$C6,$03,$C5,$03,$44,$24,$0C,$05,$F8,$A3,
    $EF,$FC,$BA,$09,$00,$00,$00,$E8,$A0,$FA,$FF,$FF,$03,$C3,$8B,$E8,
    $8B,$C3,$33,$C5,$23,$C6,$33,$C3,$03,$C7,$03,$44,$24,$20,$05,$D9,
    $02,$6F,$67,$BA,$0E,$00,$00,$00,$E8,$7F,$FA,$FF,$FF,$03,$C5,$8B,
    $F8,$8B,$C5,$33,$C7,$23,$C3,$33,$C5,$03,$C6,$03,$44,$24,$34,$05,
    $8A,$4C,$2A,$8D,$BA,$14,$00,$00,$00,$E8,$5E,$FA,$FF,$FF,$03,$C7,
    $8B,$F0,$8B,$C7,$33,$C6,$33,$C5,$03,$C3,$03,$44,$24,$18,$05,$42,
    $39,$FA,$FF,$BA,$04,$00,$00,$00,$E8,$3F,$FA,$FF,$FF,$03,$C6,$8B,
    $D8,$8B,$C6,$33,$C3,$33,$C7,$03,$C5,$03,$44,$24,$24,$05,$81,$F6,
    $71,$87,$BA,$0B,$00,$00,$00,$E8,$20,$FA,$FF,$FF,$03,$C3,$8B,$E8,
    $8B,$C3,$33,$C5,$33,$C6,$03,$C7,$03,$44,$24,$30,$05,$22,$61,$9D,
    $6D,$BA,$10,$00,$00,$00,$E8,$01,$FA,$FF,$FF,$03,$C5,$8B,$F8,$8B,
    $C5,$33,$C7,$33,$C3,$03,$C6,$03,$44,$24,$3C,$05,$0C,$38,$E5,$FD,
    $BA,$17,$00,$00,$00,$E8,$E2,$F9,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C7,
    $33,$C6,$33,$C5,$03,$C3,$03,$44,$24,$08,$05,$44,$EA,$BE,$A4,$BA,
    $04,$00,$00,$00,$E8,$C3,$F9,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C6,$33,
    $C3,$33,$C7,$03,$C5,$03,$44,$24,$14,$05,$A9,$CF,$DE,$4B,$BA,$0B,
    $00,$00,$00,$E8,$A4,$F9,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C3,$33,$C5,
    $33,$C6,$03,$C7,$03,$44,$24,$20,$05,$60,$4B,$BB,$F6,$BA,$10,$00,
    $00,$00,$E8,$85,$F9,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C5,$33,$C7,$33,
    $C3,$03,$C6,$03,$44,$24,$2C,$05,$70,$BC,$BF,$BE,$BA,$17,$00,$00,
    $00,$E8,$66,$F9,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C7,$33,$C6,$33,$C5,
    $03,$C3,$03,$44,$24,$38,$05,$C6,$7E,$9B,$28,$BA,$04,$00,$00,$00,
    $E8,$47,$F9,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C6,$33,$C3,$33,$C7,$03,
    $C5,$03,$44,$24,$04,$05,$FA,$27,$A1,$EA,$BA,$0B,$00,$00,$00,$E8,
    $28,$F9,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C3,$33,$C5,$33,$C6,$03,$C7,
    $03,$44,$24,$10,$05,$85,$30,$EF,$D4,$BA,$10,$00,$00,$00,$E8,$09,
    $F9,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C5,$33,$C7,$33,$C3,$03,$C6,$03,
    $44,$24,$1C,$05,$05,$1D,$88,$04,$BA,$17,$00,$00,$00,$E8,$EA,$F8,
    $FF,$FF,$03,$C7,$8B,$F0,$8B,$C7,$33,$C6,$33,$C5,$03,$C3,$03,$44,
    $24,$28,$05,$39,$D0,$D4,$D9,$BA,$04,$00,$00,$00,$E8,$CB,$F8,$FF,
    $FF,$03,$C6,$8B,$D8,$8B,$C6,$33,$C3,$33,$C7,$03,$C5,$03,$44,$24,
    $34,$05,$E5,$99,$DB,$E6,$BA,$0B,$00,$00,$00,$E8,$AC,$F8,$FF,$FF,
    $03,$C3,$8B,$E8,$8B,$C3,$33,$C5,$33,$C6,$03,$C7,$03,$44,$24,$40,
    $05,$F8,$7C,$A2,$1F,$BA,$10,$00,$00,$00,$E8,$8D,$F8,$FF,$FF,$03,
    $C5,$8B,$F8,$8B,$C5,$33,$C7,$33,$C3,$03,$C6,$03,$44,$24,$0C,$05,
    $65,$56,$AC,$C4,$BA,$17,$00,$00,$00,$E8,$6E,$F8,$FF,$FF,$03,$C7,
    $8B,$F0,$8B,$C5,$F7,$D0,$0B,$C6,$33,$C7,$03,$C3,$03,$44,$24,$04,
    $05,$44,$22,$29,$F4,$BA,$06,$00,$00,$00,$E8,$4D,$F8,$FF,$FF,$03,
    $C6,$8B,$D8,$8B,$C7,$F7,$D0,$0B,$C3,$33,$C6,$03,$C5,$03,$44,$24,
    $20,$05,$97,$FF,$2A,$43,$BA,$0A,$00,$00,$00,$E8,$2C,$F8,$FF,$FF,
    $03,$C3,$8B,$E8,$8B,$C6,$F7,$D0,$0B,$C5,$33,$C3,$03,$C7,$03,$44,
    $24,$3C,$05,$A7,$23,$94,$AB,$BA,$0F,$00,$00,$00,$E8,$0B,$F8,$FF,
    $FF,$03,$C5,$8B,$F8,$8B,$C3,$F7,$D0,$0B,$C7,$33,$C5,$03,$C6,$03,
    $44,$24,$18,$05,$39,$A0,$93,$FC,$BA,$15,$00,$00,$00,$E8,$EA,$F7,
    $FF,$FF,$03,$C7,$8B,$F0,$8B,$C5,$F7,$D0,$0B,$C6,$33,$C7,$03,$C3,
    $03,$44,$24,$34,$05,$C3,$59,$5B,$65,$BA,$06,$00,$00,$00,$E8,$C9,
    $F7,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C7,$F7,$D0,$0B,$C3,$33,$C6,$03,
    $C5,$03,$44,$24,$10,$05,$92,$CC,$0C,$8F,$BA,$0A,$00,$00,$00,$E8,
    $A8,$F7,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C6,$F7,$D0,$0B,$C5,$33,$C3,
    $03,$C7,$03,$44,$24,$2C,$05,$7D,$F4,$EF,$FF,$BA,$0F,$00,$00,$00,
    $E8,$87,$F7,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C3,$F7,$D0,$0B,$C7,$33,
    $C5,$03,$C6,$03,$44,$24,$08,$05,$D1,$5D,$84,$85,$BA,$15,$00,$00,
    $00,$E8,$66,$F7,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C5,$F7,$D0,$0B,$C6,
    $33,$C7,$03,$C3,$03,$44,$24,$24,$05,$4F,$7E,$A8,$6F,$BA,$06,$00,
    $00,$00,$E8,$45,$F7,$FF,$FF,$03,$C6,$8B,$D8,$8B,$C7,$F7,$D0,$0B,
    $C3,$33,$C6,$03,$C5,$03,$44,$24,$40,$05,$E0,$E6,$2C,$FE,$BA,$0A,
    $00,$00,$00,$E8,$24,$F7,$FF,$FF,$03,$C3,$8B,$E8,$8B,$C6,$F7,$D0,
    $0B,$C5,$33,$C3,$03,$C7,$03,$44,$24,$1C,$05,$14,$43,$01,$A3,$BA,
    $0F,$00,$00,$00,$E8,$03,$F7,$FF,$FF,$03,$C5,$8B,$F8,$8B,$C3,$F7,
    $D0,$0B,$C7,$33,$C5,$03,$C6,$03,$44,$24,$38,$05,$A1,$11,$08,$4E,
    $BA,$15,$00,$00,$00,$E8,$E2,$F6,$FF,$FF,$03,$C7,$8B,$F0,$8B,$C5,
    $F7,$D0,$0B,$C6,$33,$C7,$03,$C3,$03,$44,$24,$14,$05,$82,$7E,$53,
    $F7,$BA,$06,$00,$00,$00,$E8,$C1,$F6,$FF,$FF,$03,$C6,$8B,$D8,$8B,
    $C7,$F7,$D0,$0B,$C3,$33,$C6,$03,$C5,$03,$44,$24,$30,$05,$35,$F2,
    $3A,$BD,$BA,$0A,$00,$00,$00,$E8,$A0,$F6,$FF,$FF,$03,$C3,$8B,$E8,
    $8B,$C6,$F7,$D0,$0B,$C5,$33,$C3,$03,$C7,$03,$44,$24,$0C,$05,$BB,
    $D2,$D7,$2A,$BA,$0F,$00,$00,$00,$E8,$7F,$F6,$FF,$FF,$03,$C5,$8B,
    $F8,$8B,$C3,$F7,$D0,$0B,$C7,$33,$C5,$03,$C6,$03,$44,$24,$28,$05,
    $91,$D3,$86,$EB,$BA,$15,$00,$00,$00,$E8,$5E,$F6,$FF,$FF,$03,$C7,
    $8B,$F0,$8B,$04,$24,$01,$58,$0C,$8B,$04,$24,$01,$70,$10,$8B,$04,
    $24,$01,$78,$14,$8B,$04,$24,$01,$68,$18,$8B,$04,$24,$33,$D2,$89,
    $50,$08,$8B,$04,$24,$83,$C0,$1C,$33,$C9,$BA,$40,$00,$00,$00,$E8,
    $B4,$F6,$FF,$FF,$83,$C4,$44,$5D,$5F,$5E,$5B,$C3,$53,$56,$57,$55,
    $51,$8B,$D9,$8B,$F2,$8B,$D6,$C1,$EA,$1D,$01,$13,$8B,$D6,$C1,$E2,
    $03,$01,$53,$04,$3B,$53,$04,$76,$02,$FF,$03,$89,$04,$24,$85,$F6,
    $76,$4F,$B8,$40,$00,$00,$00,$8B,$7B,$08,$2B,$C7,$3B,$C6,$77,$2A,
    $B9,$40,$00,$00,$00,$2B,$4B,$08,$8D,$54,$3B,$1C,$8B,$04,$24,$E8,
    $08,$F6,$FF,$FF,$BD,$40,$00,$00,$00,$2B,$6B,$08,$2B,$F5,$01,$2C,
    $24,$8B,$C3,$E8,$14,$F7,$FF,$FF,$EB,$13,$8D,$54,$3B,$1C,$8B,$04,
    $24,$8B,$CE,$E8,$E4,$F5,$FF,$FF,$01,$73,$08,$33,$F6,$85,$F6,$77,
    $B1,$5A,$5D,$5F,$5E,$5B,$C3,$90,$92,$E8,$CE,$F5,$FF,$FF,$C3,$90,
    $33,$D2,$EB,$0A,$81,$FA,$80,$00,$00,$00,$77,$07,$40,$42,$80,$38,
    $00,$75,$F1,$8B,$C2,$C3,$8B,$C0,$00,$00,$00,$00,$C0,$F3,$18,$00,
    $EC,$F3,$18,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,
    $C9,$85,$7D,$75,$A2,$85,$7D,$75,$8F,$17,$01,$CB,$49,$00,$5A,$00,
    $04,$F4,$18,$00,$04,$00,$00,$00,$00,$00,$00,$00,$46,$00,$00,$00,
    $01,$00,$00,$00,$05,$00,$00,$00,$01,$00,$00,$00,$78,$F4,$18,$00,
    $2F,$89,$AE,$75,$8F,$17,$01,$CB,$49,$00,$5A,$00,$04,$F4,$18,$00,
    $04,$00,$00,$00,$98,$00,$00,$00,$E0,$11,$78,$00,$01,$00,$00,$00,
    $13,$00,$00,$00,$04,$00,$00,$00,$04,$00,$00,$00,$43,$00,$00,$00,
    $01,$00,$00,$00,$93,$00,$10,$01,$00,$00,$00,$00,$04,$00,$00,$00,
    $14,$00,$00,$00,$43,$00,$00,$00,$01,$00,$00,$00,$93,$00,$10,$01,
    $00,$00,$00,$00,$04,$00,$00,$00,$05,$00,$00,$00,$01,$00,$00,$00,
    $0F,$00,$00,$00,$93,$00,$10,$01,$00,$00,$00,$00,$46,$00,$00,$00,
    $05,$00,$00,$00,$01,$00,$00,$00,$0F,$00,$00,$00,$93,$00,$10,$01,
    $00,$00,$00,$00,$01,$00,$00,$00,$05,$00,$00,$00,$47,$00,$00,$00,
    $43,$00,$00,$00,$11,$00,$00,$00,$9C,$F4,$18,$00,$04,$8A,$AE,$75,
    $8F,$17,$01,$CB,$04,$00,$00,$00,$93,$00,$10,$01,$49,$00,$5A,$00,
    $01,$00,$00,$00,$01,$00,$00,$00,$00,$00,$00,$00,$30,$F5,$18,$00,
    $DF,$69,$B1,$75,$63,$51,$E1,$B7,$1C,$CB,$18,$56,$D5,$44,$50,$F4,
    $8E,$BE,$87,$92,$47,$38,$BF,$30,$00,$B2,$F6,$CE,$B9,$2B,$2E,$6D,
    $72,$A5,$65,$0B,$2B,$1F,$9D,$A9,$E4,$98,$D4,$47,$9D,$12,$0C,$E6,
    $56,$8C,$43,$84,$0F,$06,$7B,$22,$C8,$7F,$B2,$C0,$81,$F9,$E9,$5E,
    $3A,$73,$21,$FD,$F3,$EC,$58,$9B,$AC,$66,$90,$39,$65,$E0,$C7,$D7,
    $1E,$5A,$FF,$75,$D7,$D3,$36,$14,$90,$4D,$6E,$B2,$49,$C7,$A5,$50,
    $02,$41,$DD,$EE,$BB,$BA,$14,$8D,$74,$34,$4C,$2B,$2D,$AE,$83,$C9,
    $E6,$27,$BB,$67,$9F,$A1,$F2,$05,$58,$1B,$2A,$A4,$11,$95,$61,$42,
    $CA,$0E,$99,$E0,$83,$88,$D0,$7E,$3C,$02,$08,$1D,$F5,$7B,$3F,$BB,
    $AE,$F5,$76,$59,$67,$6F,$AE,$F7,$20,$E9,$E5,$95,$D9,$62,$1D,$34,
    $92,$DC,$54,$D2,$4B,$56,$8C,$70,$04,$D0,$C3,$0E,$BD,$49,$FB,$AC,
    $76,$C3,$32,$4B,$2F,$3D,$6A,$E9,$E8,$B6,$A1,$87,$A1,$30,$D9,$25,
    $5A,$AA,$10,$C4,$13,$24,$48,$62,$CC,$9D,$7F,$00,$85,$17,$B7,$9E,
    $3E,$91,$EE,$3C
  );

procedure RC6Encode(const InData; var OutData; Size:Cardinal; Key:PAnsiChar);
asm
  pushad
  push True
  push key
  push size
  push OutData
  push InData
  call OPCODE
  popad
end;

procedure RC6Decode(const InData; var OutData; Size:Cardinal; Key:PAnsiChar);
asm
  pushad
  push false
  push key
  push size
  push OutData
  push InData
  call OPCODE
  popad
end;


end.

使用方法:(by cmfc)
代码:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    Memo2: TMemo;
    Memo3: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses RC6Dcrypt;

procedure TForm1.Button1Click(Sender: TObject);
var
InDataStr,OutDataStr :string;
Size,i : integer;
Key :PAnsiChar;
InData,OutData: array[0..1024] of byte;
begin
  InDataStr:= Memo1.Text;

  Size:=length(InDataStr);
  Key :='abcd';

  for i := 0 to size-1 do
    InData[i]:=byte(InDataStr[i+1]);

  RC6Encode(InData,OutData,Size,Key);
  OutDataStr:='';
  for i := 0 to size-1 do
    OutDataStr := OutDataStr + InttoHex(OutData[i],2);
  Memo2.Text:=OutDataStr;

  RC6Decode(OutData,InData,Size,Key);
  InDataStr:='';
  for i := 0 to size-1 do
    InDataStr := InDataStr + chr(InData[i]);
  Memo3.Text:=InDataStr;
end;

end.
[/i][/i][/i]
 
很不错。 加密算法。 收藏起来。楼主辛苦了
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
706
import
I
I
回复
0
查看
891
import
I
I
回复
0
查看
675
import
I
后退
顶部