@@ -672,8 +672,8 @@ TDECPasswordHash = class(TDECHashAuthentication)
672672 // / Returns an empty string if the the algorithm on which this is being
673673 // / used is not a Crypt/BSD compatible password hash algorithm
674674 // / </returns>
675- class function GetCryptParams (const Params : string;
676- Format : TDECFormatClass):string; virtual ;
675+ function GetCryptParams (const Params : string;
676+ Format : TDECFormatClass):string; virtual ;
677677 // / <summary>
678678 // / Returns the salt required for the crypt-like password storing
679679 // / in that format.
@@ -736,7 +736,7 @@ TDECPasswordHash = class(TDECHashAuthentication)
736736 // / </summary>
737737 class function MaxPasswordLength :UInt8; virtual ; abstract ;
738738
739- { $Region CryptFormatHandlingPublic }
739+ { $Region CryptBSDFormatHandlingPublic }
740740 // / <summary>
741741 // / Tries to find a class type by its Crypt identification
742742 // / (e.g. 2a is Bcrypt).
@@ -791,12 +791,11 @@ TDECPasswordHash = class(TDECHashAuthentication)
791791 // / <c>MaxPasswordLength</c> or if a salt with a different length than
792792 // / 128 bit has been specified.
793793 // / </exception>
794- class function GetDigestInCryptFormat (
795- const Password : string;
796- const Params : string;
797- const Salt : string;
798- SaltIsRaw : Boolean;
799- Format : TDECFormatClass):string; virtual ;
794+ function GetDigestInCryptFormat (const Password : string;
795+ const Params : string;
796+ const Salt : string;
797+ SaltIsRaw : Boolean;
798+ Format : TDECFormatClass):string; virtual ;
800799
801800 // / <summary>
802801 // / Checks whether a given password is the correct one for a password
@@ -809,55 +808,18 @@ TDECPasswordHash = class(TDECHashAuthentication)
809808 // / The data needed to "compare" the password against in Crypt/BSD like
810809 // / format: $<id>[$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
811810 // / </param>
811+ // / <param name="Format">
812+ // / Must be the right type for the Crypt/BSD encoding used by the
813+ // / algorithm used. This was implemented this way to avoid making the
814+ // / DECHashAuthentication unit dependant on the DECFormat unit not needed
815+ // / otherwise.
816+ // / </param>
812817 // / <returns>
813818 // / True if the password given is correct.
814819 // / </returns>
815- class function IsValidPassword (const Password : string;
816- const CryptData : string): Boolean; virtual ;
817-
818- // /// <summary>
819- // /// Calculates a passwort hash for the given password and returns it in
820- // /// a BSDCrypt compatible format. This method only works for those hash
821- // /// algorithms implementing the necessary GetBSDCryptID method.
822- // /// </summary>
823- // /// <param name="Password">
824- // /// Entered password for which to calculate the hash. The caller is
825- // /// responsible to ensure the maximum password length is adhered to.
826- // /// Any exceptions raised due to too long passwords are not caught here!
827- // /// </param>
828- // /// <param name="Params">
829- // /// Algorithm specific parameters used for initialization. For details see
830- // /// documentation of the concrete implementation in the algorithm.
831- // /// </param>
832- // /// <param name="Salt">
833- // /// Salt value used by the password hash calculation. Depending on the
834- // /// value of SaltIsRaw, the salt needs to specified in raw encoding or
835- // /// in the encoding used in the Crypt/BSD password storage string.
836- // /// </param>
837- // /// <param name="SaltIsRaw">
838- // /// If true the passed salt value is a raw value. If false it is encoded
839- // /// like in the Crypt/BSD password storage string.
840- // /// </param>
841- // /// <param name="Format">
842- // /// Formatting class used to format the calculated password. Different
843- // /// algorithms in BSDCrypt use different algorithms so one needs to know
844- // /// which one to pass. See description of the hash class used.
845- // /// </param>
846- // /// <returns>
847- // /// Calculated hash value in BSD crypt style format. Returns an empty
848- // /// string if the algorithm is not a Crypt/BSD style password hash algorithm.
849- // /// </returns>
850- // /// <exception cref="EDECHashException">
851- // /// Exception raised if length of <c>Password</c> is higher than
852- // /// <c>MaxPasswordLength</c> or if a salt with a different length than
853- // /// 128 bit has been specified.
854- // /// </exception>
855- // class function GetDigestInCryptFormat(
856- // const Password : string;
857- // const Params : RawByteString;
858- // const Salt : RawByteString;
859- // SaltIsRaw : Boolean;
860- // Format : TDECFormatClass):RawByteString; virtual; overload;
820+ function IsValidPassword (const Password : string;
821+ const CryptData : string;
822+ Format : TDECFormatClass): Boolean; virtual ;
861823 { $EndRegion}
862824
863825 // / <summary>
@@ -1509,9 +1471,8 @@ class function TDECPasswordHash.GetCryptID: string;
15091471 Result := ' ' ;
15101472end ;
15111473
1512- class function TDECPasswordHash.GetCryptParams (
1513- const Params : string;
1514- Format : TDECFormatClass): string;
1474+ function TDECPasswordHash.GetCryptParams (const Params : string;
1475+ Format : TDECFormatClass): string;
15151476begin
15161477 Result := ' ' ;
15171478end ;
@@ -1571,12 +1532,12 @@ class function TDECPasswordHash.GetCryptHash(
15711532 Result := ' ' ;
15721533end ;
15731534
1574- class function TDECPasswordHash.GetDigestInCryptFormat (
1575- const Password : string;
1576- const Params : string;
1577- const Salt : string;
1578- SaltIsRaw : Boolean;
1579- Format : TDECFormatClass): string;
1535+ function TDECPasswordHash.GetDigestInCryptFormat (
1536+ const Password : string;
1537+ const Params : string;
1538+ const Salt : string;
1539+ SaltIsRaw : Boolean;
1540+ Format : TDECFormatClass): string;
15801541var
15811542 SaltBytes : TBytes;
15821543begin
@@ -1598,8 +1559,9 @@ class function TDECPasswordHash.GetDigestInCryptFormat(
15981559 end ;
15991560end ;
16001561
1601- class function TDECPasswordHash.IsValidPassword (const Password : string;
1602- const CryptData : string): Boolean;
1562+ function TDECPasswordHash.IsValidPassword (const Password : string;
1563+ const CryptData : string;
1564+ Format : TDECFormatClass): Boolean;
16031565begin
16041566 Result := false;
16051567end ;
0 commit comments