Skip to content

Instantly share code, notes, and snippets.

@rdev5
Created May 4, 2018 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdev5/0a18c0b17fe6671db1070490cc7908f7 to your computer and use it in GitHub Desktop.
Save rdev5/0a18c0b17fe6671db1070490cc7908f7 to your computer and use it in GitHub Desktop.
// Returns 32 bytes of cryptographically strong random sequence, Base64-encoded
var data = (function(size){return btoa([].slice.call((window.crypto||window.msCrypto).getRandomValues(new Uint8Array(size))).map(b => String.fromCharCode(b)).join(''))})(32);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment