Exetools  

Go Back   Exetools > General > Source Code

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2015, 10:10
chessgod101's Avatar
chessgod101 chessgod101 is offline
Co-Administrator
 
Join Date: Jan 2011
Location: United States
Posts: 484
Rept. Given: 2,088
Rept. Rcvd 665 Times in 206 Posts
Thanks Given: 457
Thanks Rcvd at 626 Times in 130 Posts
chessgod101 Reputation: 500-699 chessgod101 Reputation: 500-699 chessgod101 Reputation: 500-699 chessgod101 Reputation: 500-699 chessgod101 Reputation: 500-699 chessgod101 Reputation: 500-699
Delphi Encryption Compendium HAVAL Modification

I have been working with the Delphi Encryption Compendium lately and made a small change to the HAVAL hash function to allow you to specify rounds. The author originally had fixed round types for each length.


Download:

Code:
http://rghost.net/8qktp6spV
Here is a code example of how to specify haval rounds and hash a string.
Code:
Uses DECHash, DECFmt;

Function GetHAVAL_Ansi(input: ansistring):String;
var
val:tstringstream;
hash: tHash_haval128;
len:int64;
Begin
val:=tstringstream.Create;
len:=length(input);
val.Write(input[1],Len);
val.Seek(0, soFromBeginning);
DECHash.sHavalRounds:=4;
hash:=thash_haval128.Create();
result:=string(hash.CalcStream(val,Len,TFormat_HEX)); //output is rawbytestring. We must cast it to string type.
hash.Free;
val.Free;
End;

Function GetHAVAL_unicode(input: unicodestring):String;
var
val:tstringstream;
hash: tHash_haval128;
len:int64;
Begin
val:=tstringstream.Create;
len:=length(input)*2;
val.Write(input[1],Len);
val.Seek(0, soFromBeginning);
DECHash.sHavalRounds:=4; //Specify the rounds here...
hash:=thash_haval128.Create();
result:=string(hash.CalcStream(val,Len,TFormat_HEX)); //output is rawbytestring. We must cast it to string type.
hash.Free;
val.Free;
End;
__________________
"Real knowledge is to know the extent of one's ignorance." Confucius
Reply With Quote
The Following 2 Users Gave Reputation+1 to chessgod101 For This Useful Post:
Kjacky (08-29-2015), Storm Shadow (08-31-2015)
The Following 5 Users Say Thank You to chessgod101 For This Useful Post:
anon_c (09-01-2015), Jay (08-29-2015), Kjacky (08-29-2015), niculaita (08-29-2015), yoza (08-30-2015)
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On


Similar Threads
Thread Thread Starter Forum Replies Last Post
.net modification of a method (without decompilation) Shub-Nigurrath General Discussion 8 10-15-2013 21:04
Delphi Encryption Compendium v3.0 Problem winndy General Discussion 1 02-18-2006 10:12
modification of GUI for 16-Bit Program reagent General Discussion 7 01-12-2005 13:27
MD4/MD5/HAVAL-128 has been cracked!! loveboom General Discussion 3 08-27-2004 21:19


All times are GMT +8. The time now is 12:02.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX