Code example for SecureRandom

Methods: generateSeed, setSeed

0
 
  /* 
   * Helper to reseed the shared secure random number generator. 
   */ 
  public static void reseedSharedRandom() { 
    sharedSecureRandom.setSeed(sharedSecureRandom.generateSeed(8));
  } 
 
  /* 
   * Helper to convert Byte Array to a Hex String 
   * Input: byte[] array 
   * Output: Hex string 
   */ 
  public static String byte2hex(byte[] b) {
    // StringBuffer should be used instead. 
    String hs = "";
    String stmp;
 
    for (int n = 0; n < b.length; n++) {
      stmp = Integer.toHexString(b[n] & 0XFF);