Skip to content

How can we generate Random Salt of 32 bytes in Rhino JS #1174

Answered by tuchida
Karan-nayyar asked this question in Q&A
Discussion options

You must be logged in to vote

This worked in my environment.

var random = new java.security.SecureRandom();
var salt1 = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 32);
random.nextBytes(salt1);
salt1.join(); // -69,-43,62,15,-48,-78,-68,-10,-74,-108,-43,44,-43,-108,27,8,41,102,91,-64,-88,-81,107,-46,-99,24,-64,85,11,89,52,21

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Karan-nayyar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants