Hashes the specified plaintext password using internal hashing configuration settings pertinent to password
hashing.
Note
that this method is only likely to be used in more complex environments that wish to format and/or save the
returned
Hash object in a custom manner. Most applications will find the
#encryptPassword(Object) method suitable enough for safety
and ease-of-use.
Usage
The input argument type can be any 'byte backed'
Object - almost always either a
String or character array representing passwords (character arrays are often a safer way to represent passwords
as they can be cleared/nulled-out after use. Any argument type supported by
ByteSource.Util#isCompatible(Object) is valid.
Regardless of your choice of using Strings or character arrays to represent submitted passwords, you can wrap
either as a
ByteSource by using
ByteSource.Util, for example, when the passwords are captured as
Strings:
ByteSource passwordBytes = ByteSource.Util.bytes(submittedPasswordString);
Hash hashedPassword = hashingPasswordService.hashPassword(passwordBytes);
or, identically, when captured as a character array:
ByteSource passwordBytes = ByteSource.Util.bytes(submittedPasswordCharacterArray);
Hash hashedPassword = hashingPasswordService.hashPassword(passwordBytes);