Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-12-2012, 07:30 PM   PM User | #1
CourtezBoi
New Coder

 
Join Date: Apr 2011
Location: Canada
Posts: 23
Thanks: 0
Thanked 2 Times in 2 Posts
CourtezBoi is an unknown quantity at this point
Whirlpool Encryption

So I have created a website in PHP which includes a blog. The website has an account system, and I am now trying to create a desktop application in java which will allow me to login and post into the blog.

The problem I have is with the encryption. The website uses a whirlpool hash and encryption, and I can't figure out how to duplicate the same in java. I have found a code on the internet which seems to have the functionality of creating the whirlpool hash, but I don't know which method to use to actually send it the password string and get back the hash.

Here is the PHP code that runs on my website:
PHP Code:
    function getPasswordSalt()
    {
        return 
substrstr_paddechexmt_rand() ), 8'0'STR_PAD_LEFT ), -);
    }

    function 
getPasswordHash$salt$password )
    {
        return 
$salt . ( hash'whirlpool'$salt $password ) );
    }

    function 
comparePassword$password$hash )
    {
        
$salt substr$hash0);
        return 
$hash == $this->getPasswordHash$salt$password );
    } 
The above functions are used in the following manner:
PHP Code:
getPasswordHash$this->getPasswordSalt (), $password ); 
And here is a link to the java code that I found:

http://www.koders.com/java/fidBFB2DB...AA256D2E4.aspx

If anyone has any suggestions to solve the problem it'd be greatly appreciated!
CourtezBoi is offline   Reply With Quote
Old 06-12-2012, 07:47 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Well, according to the tests in here:
PHP Code:
Whirlpool w = new Whirlpool();
byte[] digest = new byte[Whirlpool.DIGESTBITS];
w.NESSIEinit();
w.NESSIEadd("whirpool this.");
w.NESSIEfinialize(digest); 
I haven't a clue why the display method is private, but you can look at that to print a readable string if you need it for whatever reason.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 Off

Forum Jump


All times are GMT +1. The time now is 09:54 AM.


Advertisement
Log in to turn off these ads.