GPLib
Briefly
| File: | Download |
| Version: | 1.3.0.7 (03.11.2009) |
| License: | Donationware |
| Published: | 03.11.2009 |
| Size: | 156.29 kb |
| Restrict: | No |
| Source: | No |
| Examples: | Yes |
Overview
GPLib - interfaced library (GPLib.dll), containing procedures and functions to (de)encryption and digital signature data in your programs.
Currently library supports:
Algorithms (symmetric) encryption:
Blowfish, Twofish, IDEA, Cast 128, Cast 256, RC2 (Rivest), RC4 (Rivest), RC5 (Rivest), RC6 (Rivest), Rijndael (AES Winner), Square, SCOP, Sapphire, Gost, TEA, TEAN
Hash algorithms:
MD4, MD5, SHA, SHA 256 bit, SHA 512 bit, Sapphire, RIPE MD 128 bit, RIPE MD 256 bit, Haval 128 Bit, Haval 256 Bit, Whirlpool, Square, Snefru 128 Bit, Snefru 256 Bit
Algorithms conversion:
Hex, MIME Base 32, MIME Base 64, PGP with PGP-Checksum
GPLib - interface library, in other words - in addition to standard exported procedures and functions (de)encryption is implemented on the basis of class ILIbGP (see description in GP_Intrf.pas, how to implement wrapper classes for interactions with the library, see GP_Wrapper.pas);
Requirements
Instructions
Examples
Example 1.
Encryption text (using the standard exported functions):
procedure TFMain.btnTxtEncryptClick(Sender: TObject);
var
HResult:PChar;
HLib:THandle;
HProc:function(const AText,APassword: PChar; const ACipher:TGPCipherAlgorithm;
AHash: TGPHashType; AFormat:TGPFormat; var ATextOut:PChar):Integer;stdcall;
begin
HResult:=StrAlloc(Length(TxtSource.Text)+1);
if FileExists('GPLib.dll') then begin
HLib := LoadLibrary('GPLib.dll');
if HLib > 0 then begin
@HProc := GetProcAddress(HLib,'GPEncryptText');
if @HProc <> nil then
HProc(PChar(TxtSource.Text), PChar(TxtPwd.Text), caBlowfish, htMD5, fMime64, HResult);
FreeLibrary(HLib);
end;
end;
TxtEncrypt.Text := HResult;
StrDispose(HResult);
end;
In this example, the text of the field TxtSource transmitted to the encryption algorithm Blowfish, with hash MD5, the password in the field TxtPwd, and the result of encryption is copied to the field TxtEncrypt;
Example 2.
Encrypt text (use class-wrapper):
procedure TFMain.btnTxtEncryptClick(Sender: TObject); var HResult:PChar; begin HResult:=StrAlloc(Length(TxtSource.Text)+1); FWrap.EncryptText(PChar(TxtSource.Text), PChar(TxtPwd.Text), caBlowfish, htMD5, fMime64, HResult); TxtEncrypt.Text := HResult; StrDispose(HResult); end;
In this example, the text from TxtSource transmitted to the encryption algorithm Blowfish, with hash MD5, the password field TxtPwd, and the result of encryption is copied into the field TxtEncrypt; FWrap type TLibGPWrapper = class (TLibBase, ILibBase), implementation is presented in GP_Wrapper.pas
As seen from the listing on the eye noticeable difference (in relation to Example 1) in the amount of code, for one, and the same result.
