Example usage for org.bouncycastle.crypto.prng ThreadedSeedGenerator generateSeed

List of usage examples for org.bouncycastle.crypto.prng ThreadedSeedGenerator generateSeed

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.prng ThreadedSeedGenerator generateSeed.

Prototype

public byte[] generateSeed(int numBytes, boolean fast) 

Source Link

Document

Generate seed bytes.

Usage

From source file:org.crypto.sse.CryptoPrimitives.java

License:Open Source License

public static byte[] randomBytes(int sizeOfSalt) {
    byte[] salt = new byte[sizeOfSalt];
    ThreadedSeedGenerator thread = new ThreadedSeedGenerator();
    SecureRandom random = new SecureRandom();
    random.setSeed(thread.generateSeed(20, true));
    random.nextBytes(salt);//from www. ja v a  2 s. co m
    return salt;
}