Delphi-PRAXiS
Seite 3 von 4     123 4      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0 (https://www.delphipraxis.net/214436-hilfe-bei-umstellung-unit-dec5-1-zu-dec6-0-a.html)

EdAdvokat 26. Jan 2024 15:28

AW: Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0
 
ich nutze aktuell die CE 11.3 auch für dieses Projekt mit Windows 11
TurboMagic nutzt wohl Delphi 12 und der hat den Fehler erkannt und die Änderung beschrieben. Also sollte es nicht an der Delphiversion liegen können.

Kas Ob. 26. Jan 2024 17:29

AW: Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0
 
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.

TurboMagic 26. Jan 2024 17:50

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

Zitat von Kas Ob. (Beitrag 1532628)
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?

TurboMagic 26. Jan 2024 17:52

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

Zitat von EdAdvokat (Beitrag 1532615)
ich nutze aktuell die CE 11.3 auch für dieses Projekt mit Windows 11
TurboMagic nutzt wohl Delphi 12 und der hat den Fehler erkannt und die Änderung beschrieben. Also sollte es nicht an der Delphiversion liegen können.

Nee, liegt nicht an der Delphi version. Ich habe bis vor kurzem noch hauptsächlich die 11.3 genutzt.
Ob ich die 12.0 nutze sag' ich nicht. Ätsch! ;-)

Kas Ob. 27. Jan 2024 13:22

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

Zitat von TurboMagic (Beitrag 1532633)
Zitat:

Zitat von Kas Ob. (Beitrag 1532628)
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.

TurboMagic 27. Jan 2024 13:43

AW: Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0
 
Thanks for this input!
It should be doable to add this.
Is it possible that you add this to the issue tracker
over here so I won't forget it? (just the text of your post)
I'm currently working else but try to get some time for DEC
in the forseable future.

https://github.com/MHumm/DelphiEncry...pendium/issues

Kas Ob. 27. Jan 2024 14:00

AW: Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0
 
I am really sorry, but i don't even have an account on GitHub !

TurboMagic 27. Jan 2024 17:01

AW: Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0
 
Ok, then I'll make a note somewhere to implement this.

TurboMagic 28. Jan 2024 10:05

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

Zitat von Kas Ob. (Beitrag 1532664)
Zitat:

Zitat von TurboMagic (Beitrag 1532633)
Zitat:

Zitat von Kas Ob. (Beitrag 1532628)
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.

I try to understand what you propose to implement, but I'm not completely sure yet this fits the architecture.

1. You want to have an IDECHashAUthentication interface, containing all the public class methods of that one.
That's doable and I'll do that in a minute.

2. You want TDECHashClass to declare it implements this interface. In order to do this TDECHash would need to
implement this interface, as TDECHashClass is a meta class. But even then this would be against the current
architecture, as this would mean that the base class already implements all these Authentication related methods.
They have been moved to an own using in order to not let DECHashBase grow unwidely. There might be further
authentication methods added in the future and thus the whole thing might grow.

Cheers
TurboMagic

TurboMagic 28. Jan 2024 10:09

AW: Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0
 
Ok, the attempt to create an IDECHashAUthentication interface and just add all public class methods
of TDECHashAUthentication to it failed, as the compiler doesn't like class methods in an interface.

How to proceed here?

Cheers
TurboMagic


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:52 Uhr.
Seite 3 von 4     123 4      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz