Class SHA1PRNG_SecureRandomImpl

java.lang.Object
java.security.SecureRandomSpi
org.apache.harmony.security.provider.crypto.SHA1PRNG_SecureRandomImpl
All Implemented Interfaces:
Serializable

public class SHA1PRNG_SecureRandomImpl
extends SecureRandomSpi
implements Serializable
This class extends the SecureRandomSpi class implementing all its abstract methods.

To generate pseudo-random bits, the implementation uses technique described in the "Random Number Generator (RNG) algorithms" section, Appendix A, JavaTM Cryptography Architecture, API Specification & Reference.

See Also:
Serialized Form
  • Constructor Summary

    Constructors
    Constructor Description
    SHA1PRNG_SecureRandomImpl()
    Creates object and sets implementation variables to their initial values
  • Method Summary

    Modifier and Type Method Description
    protected byte[] engineGenerateSeed​(int numBytes)
    Returns a required number of random bytes.
    protected void engineNextBytes​(byte[] bytes)
    Writes random bytes into an array supplied.
    protected void engineSetSeed​(byte[] seed)
    Changes current seed by supplementing a seed argument to the current seed, if this already set; the argument is used as first seed otherwise.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SHA1PRNG_SecureRandomImpl

      public SHA1PRNG_SecureRandomImpl()
      Creates object and sets implementation variables to their initial values
  • Method Details

    • engineSetSeed

      protected void engineSetSeed​(byte[] seed)
      Changes current seed by supplementing a seed argument to the current seed, if this already set; the argument is used as first seed otherwise.
      The method overrides "engineSetSeed(byte[])" in class SecureRandomSpi.
      Specified by:
      engineSetSeed in class SecureRandomSpi
      Parameters:
      seed - - byte array
      Throws:
      NullPointerException - - if null is passed to the "seed" argument
    • engineGenerateSeed

      protected byte[] engineGenerateSeed​(int numBytes)
      Returns a required number of random bytes.
      The method overrides "engineGenerateSeed (int)" in class SecureRandomSpi.
      Specified by:
      engineGenerateSeed in class SecureRandomSpi
      Parameters:
      numBytes - - number of bytes to return; should be >= 0.
      Returns:
      byte array containing bits in order from left to right
      Throws:
      InvalidParameterException - - if numBytes < 0
    • engineNextBytes

      protected void engineNextBytes​(byte[] bytes)
      Writes random bytes into an array supplied. Bits in a byte are from left to right.
      To generate random bytes, the "expansion of source bits" method is used, that is, the current seed with a 64-bit counter appended is used to compute new bits. The counter is incremented by 1 for each 20-byte output.
      The method overrides engineNextBytes in class SecureRandomSpi.
      Specified by:
      engineNextBytes in class SecureRandomSpi
      Parameters:
      bytes - - byte array to be filled in with bytes
      Throws:
      NullPointerException - - if null is passed to the "bytes" argument