List of utility methods to do Salt Value Create
String | generateSalt() generate Salt SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); return String.valueOf(secureRandom.nextInt()); |
byte[] | generateSalt() This method used to generate salt SecureRandom random = new SecureRandom(); byte[] salt = new byte[SALT_BYTE_SIZE]; random.nextBytes(salt); return salt; |
byte[] | generateSalt() Generate a random salt value of 8 bytes final byte[] salt = new byte[8]; random.nextBytes(salt); return salt; |
String | generateSalt() Generates a salt for working with passwords. return new BigInteger(40, new SecureRandom()).toString(32); |
byte[] | generateSalt() generate Salt SecureRandom random = new SecureRandom(); byte salt[] = new byte[32]; random.nextBytes(salt); return salt; |
String | generateSalt(final Integer size) http://stackoverflow.com/a/18268562/2648956 final Random r = new SecureRandom(); byte[] salt = new byte[size / 2]; r.nextBytes(salt); return bytesToString(salt); |
byte[] | generateSalt(int bits) This method generates a random salt using a SecureRandom number with SHA1PRNG algorithm. byte[] salt = new byte[bits / 8]; SecureRandom random = null; try { random = SecureRandom.getInstance(RANDOM_ALGORITHM); random.nextBytes(salt); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return salt; |
byte[] | generateSalt(int byteSize) generate Salt byte[] salt = new byte[byteSize]; r.nextBytes(salt); return salt; |
byte[] | generateSalt(int length) generate Salt byte[] salt = new byte[length]; SecureRandom rnd = null; try { rnd = SecureRandom.getInstanceStrong(); } catch (NoSuchAlgorithmException e) { rnd = new SecureRandom(); rnd.nextBytes(salt); ... |
String | generateSalt(int numberOfBytes) md5 128bit 16bytes sha1 160bit 20bytes sha256 256bit 32bytes sha384 384bit 48bites sha512 512bit 64bites byte[] salt = new byte[numberOfBytes]; random.nextBytes(salt); return toHex(salt); |