Java Salt Value Create generateSalt()

Here you can find the source of generateSalt()

Description

generate Salt

License

Open Source License

Declaration

private static byte[] generateSalt() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

public class Main {
    private static byte[] generateSalt() {
        try {/* w  w w  .j  a  va  2  s. c om*/
            final byte[] salt = new byte[8];
            final SecureRandom saltGen = SecureRandom.getInstance("SHA1PRNG");
            saltGen.nextBytes(salt);
            return salt;
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. createSalt()
  2. createSalt(int byte_length)
  3. generateSalt()
  4. generateSalt()
  5. generateSalt()
  6. generateSalt()
  7. generateSalt()
  8. generateSalt()