The android developer’s guide on securerandom says
Supported Algorithms
SHA1PRNG: Based on SHA-1. **Not guaranteed to be compatible with the SHA1PRNG algorithm on the reference implementation.**
The default algorithm is defined by the first SecureRandomSpi provider<br> found in the VM's installed security providers. Use Security to install custom SecureRandomSpi providers.
And true to this this when seeded with the same value, the sequence in java and android are different. How do I make android use the sha11prng implementation same as the one used in java?
In general you need the
SecureRandomSpiimplementation of your desktop Java and include it into your Android project.By extending the standard SecureRandom implementation you can make use of the protected constructor that allows to specify the
SecureRandomSpidirectly.However using the standard/Oracle Java SHA1PRNG implementation is not that easy as the source code is not part of the SDK. IMHO the much simpler way is getting the Android sources from AOSP end extract the SHA1PRNG implementation used on Android. This would result is the opposite way as you asked for.
BTW: The Android implementation is the one from Apache Harmony project. The main implementation is in the file
org.apache.harmony.security.provider.crypto.SHA1PRNG_SecureRandomImpl.