Blowfish implementation not agreeing with Dojo


#1

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);

blowfish.encrypt(block);

BigInteger tempStorage;

tempStorage.loadFromMemoryBlock(block);

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

http://sladex.org/blowfish.js/


#2

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.


#3

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.”