Created
July 17, 2023 09:49
-
-
Save shreyassanthu77/a77996f4548a1c637e0bf561bbe7e66a to your computer and use it in GitHub Desktop.
Generates a random string of given length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const len = +(Deno.args[0] ?? "32"); | |
const buf = new Uint8Array(len); | |
crypto.getRandomValues(buf); | |
const base64 = btoa(String.fromCharCode(...buf)); | |
console.log(base64); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment