Giter VIP home page Giter VIP logo

delphidec's People

Watchers

 avatar

delphidec's Issues

TCipher_2DES encrypts as single-DES

What steps will reproduce the problem?
1. Create a TChiper_2DES object
2. Encrypt using double-length key (16 bytes)
3. Compare to results using doubled single-length key with same first half as 
in #2

What is the expected output? What do you see instead?
Results from #3 should be different than results from #2, but are always the 
same, equivalent to single DES.

What version of the product are you using? On what operating system?
Version 5.2, Win 7 64-bit, Delphi 2010 Version 14.0.3593.25826 

Please provide any additional information below.
Strangely, decrypt works correctly. Use 
http://people.eku.edu/styere/Encrypt/JS-DES.html to test, as it does both 
single and triple DES.

Original issue reported on code.google.com by [email protected] on 17 Aug 2012 at 3:09

Haval hashes Rounds value is reset by Init call; Whirlpool rev2 missing; Tiger hash name

##1. Currently Haval hashes have "hardcoded" rounds value:
· THash_Haval128 = 128/3
· THash_Haval160 = 160/3
· THash_Haval192 = 192/4
· THash_Haval224 = 224/4
· THash_Haval256 = 256/5
~~ Would be helpful to allow to set Rounds value in constructor.


##2. Problem currently is that FCount (rounds) value is reset to "0" in 
"TDECHash.Init;" - called in CalcBuffer (CalcBinary), so even user created an 
object:

  Haval := THash_Haval256.Create;
  Haval.Rounds := 4;
  Haval.CalcBinary(Str, DECFmt.TFormat_HEXL);
  Haval.Free;

= would have no effect, because .SetRounds is called twice - 1st to "4", then 
2nd time by Init resets to "0", which will then results in default "5" value 
for 256 digest..


##3. Some of Hash functions have counterintuitive names:
· THash_Whirlpool  = is actually Whirlpool-0
· THash_Whirlpool1 = Whirlpool-T
· And Whirlpool/Whirlpool-2 = not implemented..

##4. Implemented "THash_Tiger" has is actually:
· Tiger (192/3)
~~ Would be helpful to change name / implement / allow to set Digest and 
Rounds..

For example:
· Tiger (128/3),  · Tiger (160/3),  · Tiger (192/3)
· Tiger (128/4),  · Tiger (160/4),  · Tiger (192/4)


##5. Would be useful to add "SHA-2 (224)" Hash


------------------------------------------------
## Current Haval workaround - manually calling all "Init, manual set, Calc" 
code:

program Project1;
{$AppType Console}
uses
  DECHash,
  DECFmt;

function Haval_Str(Str: string; DS: Integer; Rounds: Byte = 5): string;
var
  Haval: THashBaseHaval;
begin
  Result := '';

  case DS of
    128: Haval := THash_Haval128.Create;
    160: Haval := THash_Haval160.Create;
    192: Haval := THash_Haval192.Create;
    224: Haval := THash_Haval224.Create;
    256: Haval := THash_Haval256.Create;
  end;

  try
    Haval.Init; //Called by CalcBinary/CalcBuffer == Resets any customizations made..
    Haval.Rounds := Rounds; //override value.
    Haval.Calc(Str[1], Length(Str));
    Haval.Done;
    Result := Haval.DigestStr(DECFmt.TFormat_HEXL);
  finally
    Haval.Free;
  end;
end;

var
  d, r: Integer;
begin
  for r := 3 to 5 do
  begin
    d := 128;
    repeat
      Writeln( 'haval (', d, '/', r, '): ', Haval_Str('test', d, r) );
      inc(d, 32);
    until (d > 256);
    Writeln;
  end;
  Readln;
end.
------------------------------------------------

Original issue reported on code.google.com by [email protected] on 14 Nov 2012 at 5:20

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.