AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Delphi Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0
Thema durchsuchen
Ansicht
Themen-Optionen

Hilfe bei Umstellung Unit DEC5.1 zu DEC6.0

Ein Thema von haentschman · begonnen am 11. Jan 2024 · letzter Beitrag vom 31. Jan 2024
Antwort Antwort
Kas Ob.

Registriert seit: 3. Sep 2023
435 Beiträge
 
#1

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

  Alt 28. Jan 2024, 13:17
I see this discrepancy in the implementation
Code:
// in DECHash.pas
  THashBaseMD4 = class(TDECHashAuthentication)
  THash_SHA0 = class(THashBaseMD4)
  THash_SHA256 = class(THash_SHA0)

// while in DECHashAuthentication.pas
  TDECHashAuthentication = class(TDECHash)

// but in DECHashBase.pas
  TDECHash = class(TDECObject, IDECHash)
Now we left with TDECHash without visibility to TDECHashAuthentication and its class methods, while all the derived class has full functionality of HashAuthentication,

What is misleading is the naming in TDECHashAuthentication, as the main class (core type) to be used is TDECHashAuthenticationClass from DECHashAuthentication.pas, not TDECHashClass from DECHashBase.

With current implementation, de facto the base class is TDECHashAuthentication !

and that why i suggest to not change anything for now, just add documented global function (like ValidPasswordHash) to serve this functionality where the result is TDECHashAuthenticationClass , but the input is TDECHashClass !!
Kas
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
435 Beiträge
 
#2

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

  Alt 28. Jan 2024, 13:43
Here this is the smallest workaround the problem for this case like what OP presented.

the modification are only in DECHashAuthentication.pas
Code:
function ValidAuthHash(HashClass: TDECHashClass): TDECHashAuthenticationClass;
procedure SetDefaultAuthHashClass(HashClass: TDECHashClass);

implementation

uses
  DECUtil;

resourcestring
  sAuthHashNoDefault         = 'No default hash has been registered';

var

  FDefaultAutheticationHashClass: TDECHashAuthenticationClass = nil;

function ValidAuthHash(HashClass: TDECHashClass): TDECHashAuthenticationClass;
begin
  if Assigned(HashClass) then
    Result := TDECHashAuthenticationClass(HashClass)
  else
    Result := FDefaultAutheticationHashClass;

  if not Assigned(Result) then
    raise EDECHashException.CreateRes(@sAuthHashNoDefault);
end;

procedure SetDefaultAuthHashClass(HashClass: TDECHashClass);
begin
  Assert(Assigned(HashClass), 'Do not set a nil default hash class!');

  FDefaultAutheticationHashClass := TDECHashAuthenticationClass(HashClass);
end;
For (legacy) code like haentschman the need is to add DECHashAuthentication in uses clause and use ValidAuthHash instead ValidHash.

BUT, they are named/called AuthHash while in fact they are just key deriving methods/algorithms, so.... (i am lousy at naming) ... find a better naming as i took the class name only while the functionality has nothing to do with authentication though.
Kas
  Mit Zitat antworten Zitat
TurboMagic

Registriert seit: 28. Feb 2016
Ort: Nordost Baden-Württemberg
3.076 Beiträge
 
Delphi 12 Athens
 
#3

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

  Alt 28. Jan 2024, 17:43
Hello,

I copied your implementation now and renamed it.
We now have

function ValidAuthenticationHash(HashClass: TDECHashClass): TDECHashAuthenticationClass;
procedure SetDefaultAuthenticationHashClass

Best regards

TurboMagic
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.441 Beiträge
 
Delphi 12 Athens
 
#4

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

  Alt 29. Jan 2024, 09:06
Hallöle...

@Kas Ob. / TurboMagic
Könntet ihr bitte die technischen Details im Thred zum DEC erörtern? https://www.delphipraxis.net/206973-...fentlicht.html
Danke...

Ich habe am Freitag die neue Unit ins Release reingenommen... Ich habe die SQL Statements in Ressourcen verschlüsselt in der EXE drin. Bei jedem Aufruf zur Datenbank wird das verschlüsselte SQL genommen, entschlüsselt und der Query zugewiesen. Wenn das schiefläuft, dann ist das SQL = ''.
Dann kommt das raus...(Bild) Bei gefühlten 100+ Aufrufen kommt das richtige Ergebnis raus...dann kommt irgendwann der Fehler. Mein Postfach ist gestresst.
PS: es fällt erst mal auf, daß immer Threads involviert sind...

Ich werde zurückrudern, bis auch mein Tool (SQLCreator), was noch auf V5 läuft, umgestellt ist. Wenn das dann immer noch der Fall ist, kann man sich nicht drauf verlassen...
Angehängte Grafiken
Dateityp: png Fehler.PNG (36,3 KB, 21x aufgerufen)
Dateityp: png Fehler1.PNG (68,1 KB, 13x aufgerufen)

Geändert von haentschman (29. Jan 2024 um 10:12 Uhr)
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
435 Beiträge
 
#5

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

  Alt 29. Jan 2024, 11:17
Can you capture/log the exact SQL query when the exception happen ?

I am sorry, can't understand the exception !, is it a fail to find parameter or something, like the there is SQL but broken !?

Anyway, i suspect the use of RawByteString is and as always the root of evil, so i will adjust your code a little to remove this dependency as much as i can.

ps: i asked for specific test vector to guarantee the migration of your code, and you didn't answer with one specific value, the one with strange Unicode would be helpful, yet from my understanding it is working fine, mostly !,
again does the exception due to broken/corrupted SQL or truncated SQL.... only after that we can guess if some combination of Unicode chars lost.

More details will remove the guessing game, and only you can get these details.
Kas
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:35 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz