ianyates / delphidec Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/delphidec
Automatically exported from code.google.com/p/delphidec
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
##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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.