-
Notifications
You must be signed in to change notification settings - Fork 0
/
DrcomDecryptor.pas
86 lines (79 loc) · 1.97 KB
/
DrcomDecryptor.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
unit DrcomDecryptor;
// Mail: flyteas@gmail.com | flyshit@cqu.edu.cn
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMainForm = class(TForm)
DecryptBtn: TButton;
CipherTextEdit: TEdit;
MailLabel: TLabel;
procedure DecryptBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.DecryptBtnClick(Sender: TObject);
var
CipherTextLength: integer;
CipherTextCharPos: integer;
DecryptResultChar: integer;
DecryptTable: array[1..16] of integer;
CharTemp: string;
DecryptResult: string;
begin
//解密表
DecryptTable[1]:=28;
DecryptTable[2]:=57;
DecryptTable[3]:=86;
DecryptTable[4]:=19;
DecryptTable[5]:=47;
DecryptTable[6]:=76;
DecryptTable[7]:=9;
DecryptTable[8]:=38;
DecryptTable[9]:=66;
DecryptTable[10]:=95;
DecryptTable[11]:=28;
DecryptTable[12]:=57;
DecryptTable[13]:=86;
DecryptTable[14]:=18;
DecryptTable[15]:=47;
DecryptTable[16]:=76;
if CipherTextEdit.Text='a' then
begin
messagebox(0,'密码为空!','错误',0);
end
else
begin
CipherTextLength:=length(CipherTextEdit.Text);
if CipherTextLength > 17 then
begin
messagebox(0,'密文长度错误!最多只为17位!','错误',0);
end
else
begin
CipherTextLength:=CipherTextLength-1;
CipherTextCharPos:=0;
while CipherTextCharPos < CipherTextLength do
begin
CipherTextCharPos:=CipherTextCharPos+1;
CharTemp:= copy(CipherTextEdit.Text,CipherTextCharPos,1);
DecryptResultChar:=ord(CharTemp[1]);
DecryptResultChar:=DecryptResultChar-DecryptTable[CipherTextCharPos];
if DecryptResultChar < 32 then
begin
DecryptResultChar:=DecryptResultChar+95;
end;
DecryptResult:=DecryptResult+char(DecryptResultChar);
end;
end;
end;
CipherTextEdit.Text:=DecryptResult;
end;
end.