Created
July 13, 2023 17:51
-
-
Save gschueler/e6f47dafcf14e952a09a66bf2804c1b9 to your computer and use it in GitHub Desktop.
generate random key
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
import java.security.*; | |
def len=256 | |
if(args.length>0){ | |
len = Integer.parseInt(args[0]) | |
} | |
byte[] sharedKey = new byte[len] | |
new SecureRandom().nextBytes(sharedKey) | |
//log the random key | |
println(Base64.encoder.encodeToString(sharedKey)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this is equivalent: