code: public static byte[] generateSalt() throws NoSuchAlgorithmException {
          SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
          byte[] salt = new byte[8];
          random.nextBytes(salt);
          return salt;
      }
docs: Generate a random salt.
  
  @return
  the random salt.
  @throws NoSuchAlgorithmException
  the NoSuchAlgorithmException.