Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2011
    Location
    Canada
    Posts
    23
    Thanks
    0
    Thanked 2 Times in 2 Posts

    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!

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •