Reputation: 1898
Does Spongy Castle Provide the implementation of "SHA1PRNG" Algorithm? I am asking this because Bouncy Castle doesn't seem to provide implementation of "SHA1PRNG" Algorithm.
Upvotes: 0
Views: 1879
Reputation: 55535
It maybe too late for this answer, however, here is an example of the implementation:
SpongyCastle should be the same as BountyCastle, just usable in Android.
import java.security.SecureRandom;
import java.security.Security;
public class SHA1PRNG {
//here i swapped out the bountycastle provider and used the spongycatle
static {
Security.addProvider(new org.spongycastle.jce.provider.BouncyCastleProvider());
}
public static void main(String[] args) throws Exception {
SecureRandom rng = SecureRandom.getInstance("SHA1PRNG");
rng.setSeed(711);
int numberToGenerate = 999;
byte randNumbers[] = new byte[numberToGenerate];
rng.nextBytes(randNumbers);
for(int j=0; j<numberToGenerate; j++) {
System.out.print(randNumbers[j] + " ");
}
}
}
From: www.java2s.com/Code/Java/Security/SecureRandomSHA1PRNG.htm
Upvotes: 1