Blowfish implementation not agreeing with Dojo


Im having trouble making juce’s implementation of blowfish agree with anything else. What i’m trying to do is send encrypted system information to a server to have it salt-hash that to generate a license key. I would like the server to be able to decrypt the Juce implementation of blowfish with a common javascript implementation like dojo or something.

im using this to encrypt

String encryptMe (String stringToEcrypt)
CharPointer_UTF16 asCharPtr = String(stringToEcrypt).toUTF16();

size_t asCharPtrSize = asCharPtr.sizeInBytes() /* * sizeof(CharPointer_UTF8)*/;

MemoryBlock block(asCharPtr, asCharPtrSize);


BigInteger tempStorage;


return tempStorage.toString(16);


and this to generate my key

CharPointer_UTF16 key = String("\0").toUTF16();

BlowFish blowfish (key, key.sizeInBytes());

and this is the site im using to test for agreement with dojo


Maybe the terminating null (or lack of) which is throwing it off.

I don’t understand what you’re trying to do with UTF16 for the key, that doesn’t make much sense to me.


Frankly it seems weird to me but dojo was using charCodeAt() which according to mozilla returns “A number representing the UTF-16 code unit value of the character at the given index; NaN if index is out of range.”