Feature request : Whirlpool hash algorithm

Hello Jules ;)

We all need a JUCE implementation of the famous Whirlpool hash algorithm ! For protection stuff, it's an algorithm very useful, that lots of people use, instead of SHA256 (because it's 512 bits instead of 256) or MDA5 (because it's a very bad one) which are implemented yet in JUCE.

Do some people here from the forum would be interested by this ?

It is possible that Jules has received a few weeks ago something that would help him a lot to answer to this feature request :)

Thanks in advance !

Ah! Sorry, I had that almost ready-to-go and forgot about it! Will post it asap..

Thanks Jules ;)

Yep thanks! BTW: The added class gives some (easy to fix) warnings in Visual Studio Community 2013:

1>c:\juce\modules\juce_cryptography\hashing\juce_whirlpool.cpp(178): warning C4245: 'initializing' : conversion from '__int64' to 'const juce::uint64', signed/unsigned mismatch (..\..\..\..\modules\juce_cryptography\juce_cryptography.cpp)

Ta, will fix that.

Hello again Jules !

I just want to share a possible modification of the class HashesComponent in the JUCE demo project :)

class HashesComponent  : public Component,
                         private TextEditor::Listener
        addAndMakeVisible (hashGroup);
        hashGroup.setText ("Hashes");
        hashGroup.setColour (GroupComponent::outlineColourId, Colours::grey);
        hashGroup.setColour (GroupComponent::textColourId, Colours::white);

        addAndMakeVisible (hashEntryBox);
        hashEntryBox.setMultiLine (true);
        hashEntryBox.setColour (TextEditor::backgroundColourId, Colours::white.withAlpha (0.5f));

        hashEntryBox.setReturnKeyStartsNewLine (true);
        hashEntryBox.setText ("Type some text in this box and the resulting MD5, SHA and Whirlpool hashes will update below");
        hashEntryBox.addListener (this);

        hashLabel1.setText ("Text to Hash:", dontSendNotification);
        hashLabel2.setText ("MD5 Result:", dontSendNotification);
        hashLabel3.setText ("SHA Result:", dontSendNotification);
        hashLabel4.setText ("Whirlpool Result:", dontSendNotification);

        hashLabel1.attachToComponent (&hashEntryBox, true);
        hashLabel2.attachToComponent (&md5Result, true);
        hashLabel3.attachToComponent (&shaResult, true);
        hashLabel4.attachToComponent (&whirlpoolResult, true);

        addAndMakeVisible (md5Result);
        addAndMakeVisible (shaResult);
        addAndMakeVisible (whirlpoolResult);


    void updateHashes()

    void updateMD5Result()
        const MD5 md5 (hashEntryBox.getText().toUTF8());

        md5Result.setText (md5.toHexString(), dontSendNotification);

    void updateSHA256Result()
        const SHA256 sha (hashEntryBox.getText().toUTF8());

        shaResult.setText (sha.toHexString(), dontSendNotification);

    void updateWhirlpoolResult()
        const Whirlpool whirlpool(hashEntryBox.getText().toUTF8());

        whirlpoolResult.setText(whirlpool.toHexString(), dontSendNotification);

    void resized() override
        Rectangle<int> area (getLocalBounds());
        hashGroup.setBounds (area);
        area.removeFromLeft (100);
        area.removeFromTop (10);
        area.reduce (5, 5);
        shaResult.setBounds (area.removeFromBottom (34).reduced (5));
        md5Result.setBounds (area.removeFromBottom (34).reduced (5));
        hashEntryBox.setBounds (area.reduced (5));

    GroupComponent hashGroup;
    TextEditor hashEntryBox;
    Label md5Result, shaResult, whirlpoolResult;
    Label hashLabel1, hashLabel2, hashLabel3, hashLabel4;

    void textEditorTextChanged (TextEditor& editor) override
        if (&editor == &hashEntryBox)

    void textEditorReturnKeyPressed (TextEditor& editor) override
        if (&editor == &hashEntryBox)

    void textEditorEscapeKeyPressed (TextEditor& editor) override
        if (&editor == &hashEntryBox)

    void textEditorFocusLost (TextEditor& editor) override
        if (&editor == &hashEntryBox)



Cheers Ivan, will add that!