Created
July 26, 2015 14:10
-
-
Save paddatrapper/5feae5d57ab45beb77e1 to your computer and use it in GitHub Desktop.
Pasword Hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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