diff --git a/Base32U.pas b/Base32U.pas index 4090ea7..d3c761e 100644 --- a/Base32U.pas +++ b/Base32U.pas @@ -19,7 +19,11 @@ interface uses - {$IFNDEF FPC}System.{$ENDIF}SysUtils; // For UpperCase (Base32Decode) + {$IFDEF FPC} + SysUtils; // For UpperCase (Base32Decode) + {$ELSE FPC} + System.SysUtils; // For UpperCase (Base32Decode) + {$ENDIF} type Base32 = class @@ -32,7 +36,7 @@ Base32 = class /// /// /// Unicode String containing the ANSI-Data from that Base32-Input - /// + /// class function Decode(const inString: String): String; end; diff --git a/Example/ExampleApp.dproj b/Example/ExampleApp.dproj index 653fb57..078fe35 100644 --- a/Example/ExampleApp.dproj +++ b/Example/ExampleApp.dproj @@ -1,156 +1,163 @@ - - - {260234B3-7B09-4E8B-A408-DCA45A6D6775} - 13.4 - VCL - ExampleApp.dpr - True - Debug - Win32 - 1 - Application - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;dsnap;DBXInformixDriver;IndyCore;fmxase;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IPIndyImpl;$(DCC_UsePackage) - $(BDS)\bin\delphi_PROJECTICON.ico - System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - .\$(Platform)\$(Config) - .\$(Platform)\$(Config) - false - false - false - false - false - - - DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage) - - - vcldbx;frx16;TeeDB;inetdbbde;Tee;DBXOdbcDriver;svnui;DBXSybaseASEDriver;vclimg;frxDB16;intrawebdb_120_160;fmi;fs16;vclactnband;FMXTee;TeeUI;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;frxe16;VclSmp;fsDB16;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage) - true - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - 1033 - $(BDS)\bin\default_app.manifest - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - - - DEBUG;$(DCC_Define) - false - true - true - true - - - true - true - 1033 - false - - - false - RELEASE;$(DCC_Define) - 0 - false - - - - MainSource - - -
FormOTP
- dfm -
- - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - - - - - False - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - ExampleApp.dpr - - - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - - False - True - - - 12 - - - -
+ + + {260234B3-7B09-4E8B-A408-DCA45A6D6775} + 20.1 + VCL + ExampleApp.dpr + True + Debug + Win32 + 1 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + bindcompfmx;fmx;rtl;dbrtl;IndySystem;DbxClientDriver;bindcomp;inetdb;DBXInterBaseDriver;DataSnapCommon;DataSnapClient;DataSnapServer;DataSnapProviderClient;xmlrtl;DbxCommonDriver;IndyProtocols;DBXMySQLDriver;dbxcds;soaprtl;bindengine;DBXOracleDriver;dsnap;DBXInformixDriver;IndyCore;fmxase;DBXFirebirdDriver;inet;fmxobj;inetdbxpress;DBXSybaseASADriver;fmxdae;dbexpress;DataSnapIndy10ServerTransport;IPIndyImpl;$(DCC_UsePackage) + $(BDS)\bin\delphi_PROJECTICON.ico + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + ExampleApp + + + vcldbx;frx16;TeeDB;inetdbbde;Tee;DBXOdbcDriver;svnui;DBXSybaseASEDriver;vclimg;frxDB16;intrawebdb_120_160;fmi;fs16;vclactnband;FMXTee;TeeUI;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;Intraweb_120_160;DBXDb2Driver;websnap;vclribbon;frxe16;VclSmp;fsDB16;vcl;DataSnapConnectors;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;dsnapcon;vclx;webdsnap;svn;bdertl;adortl;$(DCC_UsePackage) + true + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + 1033 + $(BDS)\bin\default_app.manifest + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + + + DBXOdbcDriver;DBXSybaseASEDriver;vclimg;vclactnband;vcldb;bindcompvcl;vcldsnap;vclie;vcltouch;DBXDb2Driver;websnap;VclSmp;vcl;DBXMSSQLDriver;dsnapcon;vclx;webdsnap;$(DCC_UsePackage) + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + + + DEBUG;$(DCC_Define) + false + true + true + true + + + true + true + 1033 + false + Debug + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + + MainSource + + +
FormOTP
+ dfm +
+ + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + Delphi.Personality.12 + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + ExampleApp.dpr + + + Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver + Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server + + + + + True + False + + + 12 + + + + +
diff --git a/Example/ExampleApp.res b/Example/ExampleApp.res index 3667719..461d970 100644 Binary files a/Example/ExampleApp.res and b/Example/ExampleApp.res differ diff --git a/Example/Form.dfm b/Example/Form.dfm index c1cd37a..ea30213 100644 --- a/Example/Form.dfm +++ b/Example/Form.dfm @@ -5,16 +5,15 @@ object FormOTP: TFormOTP BorderStyle = bsSingle Caption = 'One Time Password Example' ClientHeight = 236 - ClientWidth = 141 + ClientWidth = 188 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] - OldCreateOrder = False + Position = poScreenCenter ScreenSnap = True - PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 8 @@ -41,7 +40,7 @@ object FormOTP: TFormOTP object EdtKey: TEdit Left = 8 Top = 27 - Width = 121 + Width = 171 Height = 21 TabOrder = 0 end @@ -60,7 +59,7 @@ object FormOTP: TFormOTP object EdtHOTP: TEdit Left = 8 Top = 122 - Width = 121 + Width = 171 Height = 21 Enabled = False NumbersOnly = True @@ -69,7 +68,7 @@ object FormOTP: TFormOTP object BtnCalculate: TButton Left = 8 Top = 149 - Width = 121 + Width = 171 Height = 25 Caption = 'Calculate' Default = True @@ -79,7 +78,7 @@ object FormOTP: TFormOTP object EdtResult: TEdit Left = 8 Top = 202 - Width = 121 + Width = 171 Height = 21 ReadOnly = True TabOrder = 4 diff --git a/Example/Form.pas b/Example/Form.pas index be3919f..9fc61b0 100644 --- a/Example/Form.pas +++ b/Example/Form.pas @@ -1,5 +1,22 @@ unit Form; +{ + +original version 1.00 by wendelb + +https://github.com/wendelb/DelphiOTP + +version 1.01 created on 12 march 2024 by Skybuck Flying + ++ IFNDEFS problems with FPC solved for Delphi. ++ Position set to screen center. ++ Controls widened a bit to be able to input/see/handle larger security codes. + +Application tested and works ! Nice ! =D +Application is compatible with google authenticator. + +} + interface uses diff --git a/GoogleOTP.pas b/GoogleOTP.pas index abce6b1..d97640e 100644 --- a/GoogleOTP.pas +++ b/GoogleOTP.pas @@ -10,11 +10,32 @@ interface uses +(* {$IFNDEF FPC}System.{$ENDIF}SysUtils, {$IFNDEF FPC}System.{$ENDIF}Math, Base32U, {$IFNDEF FPC}System.{$ENDIF}DateUtils {$IFNDEF FPC} - , IdGlobal, IdHMACSHA1 + , IdGlobal, IdHMACSHA1 + {$ELSE} + , HMAC + {$IFEND}; +*) + + Base32U, + + {$IFDEF FPC} + SysUtils, + Math, + DateUtils + {$ELSE} + System.SysUtils, + System.Math, + System.DateUtils, + {$IFEND} + + {$IFNDEF FPC} + IdGlobal, + IdHMACSHA1 {$ELSE} - , HMAC + , HMAC {$IFEND}; (*