?? reg.pas
字號:
{
------------------------------------------------------------------
= Reg.dll ---- 共享軟件加密函數庫 =
= Copyright (c) 2002-2003 liangs Studio, All rights reserved =
= Created 2003/08/31 by liangs =
= Version: 3.2 =
= Homepage: http://liangs99.myetang.com =
= Email: liang_sheng@163.net =
------------------------------------------------------------------
------------------------------------------------------------------
= Reg.pas ---- 共享軟件加密函數庫Delphi調用模塊 =
= Copyright (c) 2002-2003 DreamRing Studio, All rights reserved =
= Created 2003/09/04 by dingdangy(夢叮當) =
= Version: 3.2 =
= Homepage: http://www.dreamring.9126.com =
= Email: dingdangy@163.com(夢叮當) =
------------------------------------------------------------------
}
unit Reg;
interface
uses
Windows, Messages, Classes, Graphics, Controls, Dialogs;
type
myCharArray = array of Char;
procedure GetHardDiskId();
procedure MD5Encrypt(lpInBuffer:PChar; length:Integer);
procedure BlowFishEncrypt(lpInBuffer:PChar; lpKey:PChar);
procedure BlowFishDecrypt(lpInBuffer:PChar; lpKey:PChar);
procedure SHAEncrypt(lpInBuffer:PChar; length:Integer);
procedure Secret16Encrypt(lpInBuffer:PChar; lpKey:PChar);
procedure EncryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
procedure DecryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
procedure EncryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
procedure DecryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
procedure RSAEncrypt(lpInBuffer:PChar; lpDdata:PChar; lpNdata:PChar; Mode:Integer);
procedure RSADecrypt(lpInBuffer:PChar; lpNdata:PChar; Mode:Integer);
procedure CRCFileCheck(FileNameStr:PChar);
procedure FileEncrypt(lpInputFileName:PChar; lpOutputFileName:PChar; lpKey:PChar);
procedure FileDecrypt(lpInputFileName:PChar; lpOutputFileName:PChar; lpKey:PChar);
procedure Base64Encode(lpInBuffer:PChar);
procedure Base64Decode(lpInBuffer:PChar);
procedure CRC32(lpInBuffer:PChar; length:Integer);
procedure GetDllVersion();
procedure GetMainBoardId();
procedure DesEncrypt(lpInBuffer:PChar; lpKey:PChar);
procedure DesDecrypt(lpInBuffer:PChar; lpKey:PChar);
var
hlib: HMODULE;
lpRegisterCode: PChar;
Return: String;
implementation
procedure Initialize;
begin
hlib:= LoadLibrary('Reg.dll');
lpRegisterCode:= '曹建利-E03FDBAF21B1FB6F66B37D56B8FACFAF9B4762F230B2C15F';
end;
procedure GetHardDiskId();
{獲取磁盤物理序列號}
var
GetHardDiskId: function(lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
DiskID: array [0..30] of Char;
begin
FillChar(DiskID, SizeOf(DiskID), #0);
Initialize;
if hlib <> 0 then begin
@GetHardDiskId := GetProcAddress(hLib, 'GetHardDiskId');
if @GetHardDiskId <> nil then begin
if GetHardDiskId(DiskID, lpRegisterCode) then
Return := DiskID
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hLib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure MD5Encrypt(lpInBuffer:PChar; length:Integer);
{MD5 加密}
var
MD5Encrypt: function(lpInBuffer:PChar; lpOutBuffer:PChar; length:Integer; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..32] of Char;
begin
FillChar(OutputStr, SizeOf(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@MD5Encrypt := GetProcAddress(hlib, 'MD5Encrypt');
if @MD5Encrypt <> nil then begin
if MD5Encrypt(lpInBuffer, OutputStr, length, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure BlowFishEncrypt(lpInBuffer:PChar; lpKey:PChar);
{BlowFish 加密}
var
BlowFishEncrypt: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..200] of Char;//輸出長度請參考幫助文件
begin
FillChar(OutputStr, Sizeof(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@BlowFishEncrypt := GetProcAddress(hlib, 'BlowFishEncrypt');
if @BlowFishEncrypt <> nil then begin
if BlowFishEncrypt(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure BlowFishDecrypt(lpInBuffer:PChar; lpKey:PChar);
{BlowFish 解密}
var
BlowFishDecrypt: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..200] of Char;//輸出長度請參考幫助文件
begin
FillChar(OutputStr, Sizeof(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@BlowFishDecrypt := GetProcAddress(hlib, 'BlowFishDecrypt');
if @BlowFishDecrypt <> nil then begin
if BlowFishDecrypt(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure SHAEncrypt(lpInBuffer:PChar; length:Integer);
{SHA 加密}
var
SHAEncrypt: function(lpInBuffer:PChar; lpOutBuffer:PChar; length:Integer; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..129] of Char;
begin
FillChar(OutputStr, SizeOf(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@SHAEncrypt := GetProcAddress(hlib, 'SHAEncrypt');
if @SHAEncrypt <> nil then begin
if SHAEncrypt(lpInBuffer, OutputStr, length, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure Secret16Encrypt(lpInBuffer:PChar; lpKey:PChar);
{Secret16 加密}
var
Secret16Encrypt: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..16] of Char;
begin
FillChar(OutputStr, Sizeof(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@Secret16Encrypt := GetProcAddress(hlib, 'Secret16Encrypt');
if @Secret16Encrypt <> nil then begin
if Secret16Encrypt(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure EncryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
{String 加密1}
var
EncryptStringFun1: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..8192] of Char;//此處定義了輸出緩沖允許的最大范圍,您可以根據自己的實際情況定義范圍。
begin
FillChar(OutputStr, Sizeof(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@EncryptStringFun1 := GetProcAddress(hlib, 'EncryptStringFun1');
if @EncryptStringFun1 <> nil then begin
if EncryptStringFun1(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure DecryptStringFun1(lpInBuffer:PChar; lpKey:PChar);
{String 解密1}
var
DecryptStringFun1: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..4096] of Char;//此處定義了輸出緩沖允許的最大范圍,您可以根據自己的實際情況定義范圍。
begin
FillChar(OutputStr, Sizeof(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@DecryptStringFun1 := GetProcAddress(hlib, 'DecryptStringFun1');
if @DecryptStringFun1 <> nil then begin
if DecryptStringFun1(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure EncryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
{String 加密2}
var
EncryptStringFun2: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..32] of Char;
begin
FillChar(OutputStr, Sizeof(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@EncryptStringFun2 := GetProcAddress(hlib, 'EncryptStringFun2');
if @EncryptStringFun2 <> nil then begin
if EncryptStringFun2(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
FreeLibrary(hlib);
end
else
ShowMessage('無法加載DLL!');
end;
procedure DecryptStringFun2(lpInBuffer:PChar; lpKey:PChar);
{String 解密2}
var
DecryptStringFun2: function(lpInBuffer:PChar; lpKey:PChar; lpOutBuffer:PChar; lpRegisterCode:PChar): Boolean; stdcall;
OutputStr: array [0..16] of Char;
begin
FillChar(OutputStr, Sizeof(OutputStr), #0);
Initialize;
if hlib <> 0 then begin
@DecryptStringFun2 := GetProcAddress(hlib, 'DecryptStringFun2');
if @DecryptStringFun2 <> nil then begin
if DecryptStringFun2(lpInBuffer, lpKey, OutputStr, lpRegisterCode) then
Return := OutputStr
else
Return := '函數調用錯誤!'
end
else
ShowMessage('加載功能模塊出錯!');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -