List of usage examples for java.security SecureRandom getSeed
public static byte[] getSeed(int numBytes)
From source file:MainClass.java
public static void main(String args[]) throws Exception { SecureRandom ran = SecureRandom.getInstance("SHA1PRNG", "SUN"); ran.setSeed(101L);//ww w . ja va2s . c om ran.setSeed(101L); byte[] seeds = ran.getSeed(24); for (int i = 0; i < seeds.length; i++) { System.out.println("Seed[" + i + "]:" + seeds[i]); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { System.out.println(Arrays.toString(SecureRandom.getSeed(8))); }
From source file:org.linguafranca.pwdb.kdbx.dom.DomSerializableDatabase.java
public static DomSerializableDatabase createEmptyDatabase() throws IOException { DomSerializableDatabase result = new DomSerializableDatabase(); // read in the template KeePass XML database result.load(result.getClass().getClassLoader().getResourceAsStream("base.kdbx.xml")); try {//from w ww . j av a 2 s . c om // replace all placeholder dates with now String now = DomHelper.dateFormatter.format(new Date()); NodeList list = (NodeList) DomHelper.xpath.evaluate("//*[contains(text(),'${creationDate}')]", result.doc.getDocumentElement(), XPathConstants.NODESET); for (int i = 0; i < list.getLength(); i++) { list.item(i).setTextContent(now); } // set the root group UUID Node uuid = (Node) DomHelper.xpath.evaluate("//" + DomHelper.UUID_ELEMENT_NAME, result.doc.getDocumentElement(), XPathConstants.NODE); uuid.setTextContent(DomHelper.base64RandomUuid()); } catch (XPathExpressionException e) { throw new IllegalStateException(e); } result.setEncryption(new Salsa20StreamEncryptor(SecureRandom.getSeed(32))); return result; }
From source file:org.archive.crawler.selftest.SelfTestBase.java
protected void startHeritrix(String path) throws Exception { String authPassword = (new BigInteger(SecureRandom.getSeed(16))).abs().toString(16); String[] args = { "-j", path + "/jobs", "-a", authPassword }; // TODO: add auth password? heritrix = new Heritrix(); heritrix.instanceMain(args);// w ww. ja v a 2 s. c o m configureHeritrix(); heritrix.getEngine().requestLaunch("selftest-job"); }
From source file:ch.bfh.evoting.alljoyn.MessageEncrypter.java
/** * Generate a salt that will be used in the symmetric key derivation *///from w w w. j a v a 2 s. c o m public void generateSalt() { this.salt = SecureRandom.getSeed(8); this.derivateKey(password.toCharArray()); Log.d(TAG, "Salt is " + salt); }