Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.InteropServices;
//use InteropServices to use DllImport
namespace JDWeb
{
public class JDEncr
{
//Uses Ansi CharSet
//Uses StdCall CallingConvention (like in Delphi)
//uses String instead of PChar
//Parameters recognize types only, and names can differ from original function in DLL
[DllImport("JDEncr.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public static extern bool CompareStrings(String PlainText, String EncryptedText, int EncType, bool CaseSensitive);
}
}
bool P = JDEncr.CompareStrings(EnteredPassword, RegisteredPassword, EncryptionType, true);