Java Salt Value Create getMd5Salt()

Here you can find the source of getMd5Salt()

Description

get Md Salt

License

Apache License

Declaration

public static String getMd5Salt() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {

    public static String getMd5Salt() {
        return getRandomText(8);
    }/*from  w w  w  . j a  va2  s  .c o m*/

    public static String getRandomText(int length) {
        String baseChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            buffer.append(baseChars.charAt(random.nextInt(baseChars.length())));
        }
        return buffer.toString();
    }
}

Related

  1. generateSalt(int numBytes)
  2. generateSaltAESPBKDF2()
  3. generateSaltedPassword(final String password, byte[] salt, int iterationsCount, String hmacName)
  4. generateSaltedSHAHash(String algorithm, String input, String salt)
  5. generateSaltOfLength(int length)
  6. getNewSalt()
  7. getSalt()
  8. getSaltDES(int snmpEngineBoots)
  9. getSaltedString(String in)