Guest User

Untitled

a guest
Jun 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. var pw = window.crypto.getRandomValues(new Uint8Array(16));
  2. window.crypto.subtle.importKey("raw", pw, "PBKDF2", false, ["deriveBits"]).then(key => {
  3. console.log(key);
  4. var st = window.crypto.getRandomValues(new Uint8Array(16));
  5. const keySizeBits = 2048;
  6. // const keySizeBits = 2056; // this breaks
  7. return window.crypto.subtle.deriveBits({ name: "PBKDF2", salt: st, iterations: 10000, hash: "SHA-256" }, key, keySizeBits);
  8. }).then(bits => {
  9. console.log(bits);
  10. }).catch(err => {
  11. console.error(err);
  12. });
Add Comment
Please, Sign In to add comment