Closed GoogleCodeExporter closed 9 years ago
There are some minor errors in my copy/paste of example commands above, for
each example the payload in the openssl command line should obviously match the
payload used in cryptoJS
Original comment by Florian....@gmail.com
on 27 Sep 2013 at 3:25
The issue is that JavaScript strings are *not* binary data. They are UTF-16
characters. You need to decide how you want to convert those characters to
bytes. For example:
var binaryDataRepresentedAsWordArrayObject =
CryptoJS.enc.Latin1.parse("\x80\x01\x01\x01");
If you haven't converted the string to bytes, and you just pass in the string
itself, then CryptoJS will use UTF-8 by default. That's why you get different
results when the most significant bit is set, because the character \x80 is
represented by 2 bytes in UTF-8.
Original comment by Jeff.Mott.OR
on 27 Sep 2013 at 5:47
Hi Jeff,
Thank you for your quick reply.
For what it's worth I think the front page documentation is a bit lacking on
the subject of input parsing.
Since all examples use simple strings, I think this kind of subtle issue would
deserve at least a heads up in the "Cipher Input" section.
Thank you again,
Florian
Original comment by Florian....@gmail.com
on 27 Sep 2013 at 6:04
For now it's described in the hasher input section
(https://code.google.com/p/crypto-js/#The_Hasher_Input). Though, perhaps I'll
try to expound more on the topic.
Original comment by Jeff.Mott.OR
on 27 Sep 2013 at 6:08
Original issue reported on code.google.com by
Florian....@gmail.com
on 27 Sep 2013 at 3:19