$ git clone https://gist.github.com/de5cea7195d757582621.git docker-java-secure_random-test
$ cd docker-java-secure_random-test
$ docker build -t local/java-secure_random-test .
$ docker run --rm -it local/java-secure_random-test
Last active
December 19, 2015 06:52
-
-
Save md5/de5cea7195d757582621 to your computer and use it in GitHub Desktop.
Docker SecureRandom test
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
FROM java:8 | |
ENV TEST_SRC /usr/src/secure_random-test | |
RUN mkdir $TEST_SRC | |
WORKDIR $TEST_SRC | |
COPY SecureRandomTest.java $TEST_SRC/ | |
RUN javac SecureRandomTest.java | |
CMD ["java", "-cp", ".", "SecureRandomTest"] |
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.math.BigInteger; | |
import java.security.SecureRandom; | |
public class SecureRandomTest { | |
public static void main(String... argz) throws Exception { | |
SecureRandom rnd = SecureRandom.getInstance("SHA1PRNG"); | |
byte[] seed = rnd.generateSeed(1024); | |
System.out.println(new BigInteger(1, seed).toString(16)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment