public String hashPassword ( String password , String accountName ) { return Hashing . sha256 ( ) . hashString ( password , Charset . forName ( "UTF-8" ) ) . toString ( ) ; }
Returns a string representation of the hashed password using the accountName as the salt . The salt helps to prevent against rainbow table attacks where the attacker pre - calculates hashes for known strings . This method specifies the use of the user s account name as the salt value . The Encryptor . hash method can be used if a different salt is required .