Using sha1prng in both android and windows giving different sequences

I have used sha1prng in both my android program and java program as the pseudo-ramdom number generator algorithm. I sowed both of them at the same value.

But the sequence generated in android is different from the one generated in java. Why is this happening and what is the solution to this problem?

+3


source to share


1 answer


I think this is because the SHA1PRNG implementation is different on Windows and Android. Android uses Crypto as a provider, while Windows SDK uses Sun's JCE provider as the SHA1PRNG implementation. The output sequence with the same seed differs even in different JDK versions, as discussed here: http://www.derkeiler.com/Newsgroups/sci.crypt/2006-04/msg00765.html . For different SHA1PRNG implementations, you can check this link: http://www.cigital.com/justice-league-blog/2009/08/14/proper-use-of-javas-securerandom/ .



+4


source







All Articles