Using sha1prng in Android and Windows gives different sequences
I use sha1prng as a pseudo-random number generator algorithm in both my android and java programs. I seeded them with the same values.
But Android-generated sequesnce is not the same as Java-generated sequesnce. Why is this happening and what is the solution to this problem?
I think this is because the SHA1PRNG implementation is different on Windows and Android. Android uses Crypto as the provider, while the Windows SDK uses the Sun JCE provider as the SHA1PRNG implementation. Output sequences with the same seed are different even in different versions of the JDK, as discussed here: http://www.derkeiler.com/Newsgroups/sci.crypt/2006-04/msg00765.html. For different implementations of SHA1PRNG, you may want to check out this link: http://www.cigital.com/justice-league-blog/2009/08/14/proper-use-of-javas-securerandom/ .