On Thu, Mar 14, 2013 at 3:05 PM, NabbleSometimesSucks <[email protected]> wrote: > So we hash with a random key.
Just so others reading this won't be confused, 'key' isn't quite the correct term here (at least cryptographically speaking). This is really a salt. I make this distinction because keyed cryptographic hash functions are known as MAC algorithms (MAC = Message Authentication Code and the 'key' is the password). > Then how do we later compare that to the > credentials passed in for login? > > You would have to compare the two values and therefore you would need the > key that was used in the first hash, right? Correct - The output of the PasswordService's encrypt operation is a Modular Crypt Format (MCF)-formatted string that embeds the salt so it can be read later during password comparison (see http://shiro.apache.org/static/1.2.1/apidocs/org/apache/shiro/crypto/hash/format/ModularCryptFormat.html and its linked documents). This is in effect standard secure unix-style authentication. HTH! Best, Les
