I have following problem when working with googles Closure-Library.
var temp = "ks/ZUl6L5v77y7BHymYrFw===="; //sample string
var decoded = goog.crypt.base64.decodeStringToByteArray(temp);
var sha512 = new goog.crypt.Sha512();
sha512.update(decoded);
//Error: message must be a byte array
Changing the string makes the code run:
var temp1 = "heyeveryone"; //sample string
var decoded1 = goog.crypt.base64.decodeStringToByteArray(temp1);
var sha512 = new goog.crypt.Sha512();
sha512.update(decoded1);
//fine...
When having a look at the 'decoded'and 'decoded1' values, both look like byte arrays to me.
decoded [146, 207, 217, 82, 94, 139, 230, 254, 251, 203, 176, 71, 202, 102, 43, 23, 260]
decoded1 [133, 236, 158, 189, 234, 242, 162, 119]
So, what's the problem here? Why is 'decoded1' valid and 'decoded' not?
Thanks!
The first array is not a byte array -- 260
(the final value) is not a byte value. Ensure that your encoded values are not more than 255
.