Skip to content

Instantly share code, notes, and snippets.

@paddatrapper
Created July 26, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paddatrapper/5feae5d57ab45beb77e1 to your computer and use it in GitHub Desktop.
Save paddatrapper/5feae5d57ab45beb77e1 to your computer and use it in GitHub Desktop.
Pasword Hash
import java.security.SecureRandom;
public class GenerateSaltedHash {
public static void main(String[] args) {
generateHash(args[0]);
}
private static void generateHash(String pass) {
SecureRandom rand = new SecureRandom();
long salt = rand.nextLong();
System.out.println("Salt: " + salt);
int passHash = pass.hashCode();
System.out.println(passHash + salt);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment