library JDEncr;
uses
SysUtils,
Classes,
Windows,
StrUtils,
Encryption in '..\JDCommon\Encryption.pas';
//Pre-made encryption unit
{$R *.res}
//Note: use PChar and not String, and Bool, not Boolean
//stdcall goes at the end of each declaration
function CompareStrings(PlainText, EncryptedText: PChar;
EncType: Integer; CaseSensitive: Bool): Bool; stdcall;
var
S: String;
Enc: TEncType;
begin
Enc:= TEncType.Create(EncType, 1);
try
Result := False;
S:= DecryptString(EncryptedText, Enc);
if CaseSensitive then begin
if S = PlainText then
Result:= True;
end else begin
if UpperCase(S) = UpperCase(PlainText) then
Result:= True;
end;
finally
Enc.Free;
end;
end;
//exports section goes at end of unit before the begin/end.
//List everything you want to export, just like in the uses
exports
CompareStrings;
begin
end.