Public Class Form1
Declare Function EncodeMIME Lib "CryptPrj.dll" (ByVal lpszSource As String, ByVal lpszDst As String) As Long
Declare Function DecodeMIME Lib "CryptPrj.dll" (ByVal lpszSource As String, ByVal lpszDst As String) As Long
Declare Function EncodeXXE Lib "CryptPrj.dll" (ByVal lpszSource As String, ByVal lpszDst As String) As Long
Declare Function DecodeXXE Lib "CryptPrj.dll" (ByVal lpszSource As String, ByVal lpszDst As String) As Long
Declare Function EncodeUUE Lib "CryptPrj.dll" (ByVal lpszSource As String, ByVal lpszDst As String) As Long
Declare Function DecodeUUE Lib "CryptPrj.dll" (ByVal lpszSource As String, ByVal lpszDst As String) As Long
Declare Function MD5 Lib "CryptPrj.dll" (ByVal lpszSource As String, ByVal lpszDst As String) As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str1 As String
Dim str2 As String
str1 = Space(255)
str2 = TextBox1.Text
Select Case ComboBox1.SelectedIndex
Case 0
EncodeMIME(str2, str1)
Case 1
EncodeXXE(str2, str1)
Case 2
EncodeUUE(str2, str1)
Case 3
MD5(str2, str1)
End Select
TextBox2.Text = str1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim str1 As String
Dim str2 As String
str1 = Space(255)
str2 = TextBox1.Text
Select Case ComboBox1.SelectedIndex
Case 0
DecodeMIME(str2, str1)
Case 1
DecodeXXE(str2, str1)
Case 2
DecodeUUE(str2, str1)
Case 3
str1 = ""
MsgBox("不支持MD5逆运算")
End Select
TextBox2.Text = str1
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.SelectedIndex = 0
End Sub
End Class
implementation
function EncodeMIME(src:PChar;dst:PChar):HRESULT;stdcall;external 'CryptPrj.dll'
function DecodeMIME(src:PChar;dst:PChar):HRESULT;stdcall;external 'CryptPrj.dll'
function EncodeXXE(src:PChar;dst:PChar):HRESULT;stdcall;external 'CryptPrj.dll'
function DecodeXXE(src:PChar;dst:PChar):HRESULT;stdcall;external 'CryptPrj.dll'
function EncodeUUE(src:PChar;dst:PChar):HRESULT;stdcall;external 'CryptPrj.dll'
function DecodeUUE(src:PChar;dst:PChar):HRESULT;stdcall;external 'CryptPrj.dll'
function MD5(src:PChar;dst:PChar):HRESULT;stdcall;external 'CryptPrj.dll'
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
str:string;
begin
SetLength(str,255);
case RadioGroup1.ItemIndex of
0: EncodeMIME(PChar(edit1.Text),PChar(str));
1: EncodeXXE(PChar(edit1.Text),PChar(str));
2: EncodeUUE(PChar(edit1.Text),PChar(str));
3: MD5(PChar(edit1.Text),PChar(str));
end;
edit2.Text:=str;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
str:string;
begin
SetLength(str,255);
case RadioGroup1.ItemIndex of
0: DecodeMIME(PChar(edit1.Text),PChar(str));
1: DecodeXXE(PChar(edit1.Text),PChar(str));
2: DecodeUUE(PChar(edit1.Text),PChar(str));
3: begin
str:=''
ShowMessage('未实现MD5逆运算');
end;
end;
edit2.Text:=str;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
Edit2.Text:=''
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
edit2.Text:=''
end;