Class Shiro1CryptFormat

java.lang.Object
org.apache.shiro.crypto.hash.format.Shiro1CryptFormat
All Implemented Interfaces:
HashFormat, ModularCryptFormat, ParsableHashFormat

The Shiro1CryptFormat is a fully reversible Modular Crypt Format (MCF). Because it is fully reversible (i.e. Hash -> String, String -> Hash), it does NOT use the traditional MCF encoding alphabet (the traditional MCF encoding, aka H64, is bit-destructive and cannot be reversed). Instead, it uses fully reversible Base64 encoding for the Hash digest and any salt value.

Format

Hash instances formatted with this implementation will result in a String with the following dollar-sign ($) delimited format:

 $mcfFormatId$algorithmName$iterationCount$base64EncodedSalt$base64EncodedDigest
 

Each token is defined as follows:

Position Token Description Required?
1 mcfFormatId The Modular Crypt Format identifier for this implementation, equal to shiro1. ( This implies that all shiro1 MCF-formatted strings will always begin with the prefix $shiro1$ ). true
2 algorithmName The name of the hash algorithm used to perform the hash. This is an algorithm name understood by MessageDigest.getInstance, for example MD5, SHA-256, SHA-256, etc. true
3 iterationCount The number of hash iterations performed. true (1 invalid input: '<'= N invalid input: '<'= Integer.MAX_VALUE)
4 base64EncodedSalt The Base64-encoded salt byte array. This token only exists if a salt was used to perform the hash. false
5 base64EncodedDigest The Base64-encoded digest byte array. This is the actual hash result. true
Since:
1.2
See Also: