Created
April 22, 2012 12:22
-
-
Save bricef/2463908 to your computer and use it in GitHub Desktop.
Generating an IV in Java
This file contains 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.SecureRandom; | |
public static byte[] genIV(int len) throws Exception{ | |
byte[] arr = new byte[len]; | |
SecureRandom prng = SecureRandom.getInstance("SHA1PRNG"); | |
prng.nextBytes(arr); | |
return arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment