I\'m trying to hash some passwords with SHA2.
Where can I get a snippet of java code for make that?
I have seen that post but I have something missing: SHA2
Phrase would be the password that you're trying to protect. key is the salt, a unique (and known) string appended to your password before hashing, to defeat rainbow tables. Or it should be, at least. Your code is just taking it from the password itself, which is kind of pointless. It should be a long random string that is stored together with the password digest.