public static byte [ ] stringToSalt ( final String string ) { try { final MessageDigest digest = MessageDigest . getInstance ( "SHA-1" ) ; digest . reset ( ) ; return digest . digest ( string . getBytes ( "UTF-8" ) ) ; } catch ( final NoSuchAlgorithmException ex ) { throw new RuntimeException ( ex ) ; } catch ( final UnsupportedEncodingException ex ) { throw new RuntimeException ( ex ) ; } }
Uses SHA - 1 to hash the given string and returns the byte array .