Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
214 Beiträge
 
#25

AW: Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0

  Alt 27. Jan 2024, 13:22
I looked at the library,
ValidFormat and ValidHash supposed to be working as factory design, you feed them a class type and will get a class, this implementation to remove the need to hardcode a switch between algorithms.

https://en.wikipedia.org/wiki/Factory_method_pattern
but with simple function instead of a class.
I'm not completely sure yet what you want to tell with this.
Is this something which should be changed in DEC?
Did I mess up something? If so, how should it be changed?
Or was this just some explanation of where the OP's problem comes from?
ValidFormat is used as generic or general use function that can be used to one hit call, But ValidHash it seems was working in DEC v5 but with all the refactoring and separating code in different specialized units with DEC v6 it did lose the functionality code form TDECHashAuthentication.

I think DEC v6 should add/have an interface (IDECHashAuthentication) to TDECHash like this :
Zitat:
{$IFDEF FPC}
TDECHash = class(TDECObject) // does not find methods of the interface as it
// searches for AnsiString instead of RawByteString
// and thus does not find that
private
{$ELSE}
TDECHash = class(TDECObject, IDECHash, IDECHashAuthentication)
strict private
{$ENDIF}
Code:
  {$IFDEF FPC}
  TDECHash = class(TDECObject) // does not find methods of the interface as it
                                // searches for AnsiString instead of RawByteString
                                // and thus does not find that
  private
  {$ELSE}
  TDECHash = class(TDECObject, IDECHash, IDECHashAuthentication)
  strict private
  {$ENDIF}
That is the cause for the failure or the incompatibility in the code in first place with DECv5.

That one way to fix it, or without an interface with different ValidPasswordHash that solve this, yet it will fail or need more and bigger adjustment to the code, the core problem is TDECHashClass doesn't implement/import/offer the publics/interface of TDECHashAuthentication.
  Mit Zitat antworten Zitat