I would like to convert a raw string to an array of big-endian words.
- Convert a raw string to an array of big-endian words
- Characters >255 have their high-byte silently ignored.
var output = Array(input.length >> 2);
for(var i = 0; i < output.length; i++)
output[i] = 0;
for(var i = 0; i < input.length * 8; i += 8)
output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
I believe the Ruby equivalent can be String#unpack(format).
However, I don’t know what should be the correct format parameter.
Thank you for any help.