Shiro1CryptFormat

The {@code Shiro1CryptFormat} is a fully reversible <a href="http://packages.python.org/passlib/modular_crypt_format.html">Modular Crypt Format</a> (MCF). Because it is fully reversible (i.e. Hash -&gt; string, string -&gt; 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. <h2>Format</h2> <p>Hash instances formatted with this implementation will result in a string with the following dollar-sign ($) delimited format:</p> <pre> <b>$</b>mcfFormatId!(b)$</b>algorithmName!(b)$</b>iterationCount!(b)$</b>base64EncodedSalt!(b)$</b>base64EncodedDigest </pre> <p>Each token is defined as follows:</p> <table> <tr> <th>Position</th> <th>Token</th> <th>Description</th> <th>Required?</th> </tr> <tr> <td>1</td> <td>{@code mcfFormatId}</td> <td>The Modular Crypt Format identifier for this implementation, equal to <b>{@code shiro1}</b>. ( This implies that all {@code shiro1} MCF-formatted strings will always begin with the prefix {@code $shiro1$} ).</td> <td>true</td> </tr> <tr> <td>2</td> <td>{@code algorithmName}</td> <td>The name of the hash algorithm used to perform the hash. This is an algorithm name understood by {@code MessageDigest}.{@link java.security.MessageDigest#getInstance(string) getInstance}, for example {@code MD5}, {@code SHA-256}, {@code SHA-256}, etc.</td> <td>true</td> </tr> <tr> <td>3</td> <td>{@code iterationCount}</td> <td>The number of hash iterations performed.</td> <td>true (1 <= N <= Integer.MAX_VALUE)</td> </tr> <tr> <td>4</td> <td>{@code base64EncodedSalt}</td> <td>The Base64-encoded salt byte array. This token only exists if a salt was used to perform the hash.</td> <td>false</td> </tr> <tr> <td>5</td> <td>{@code base64EncodedDigest}</td> <td>The Base64-encoded digest byte array. This is the actual hash result.</td> <td>true</td> </tr> </table>

@see ModularCryptFormat @see ParsableHashFormat

Constructors

this
this()
Undocumented in source.

Members

Functions

format
string format(Hash hash)
Undocumented in source. Be warned that the author may not have intended to support it.
getId
string getId()
Undocumented in source. Be warned that the author may not have intended to support it.
parse
Hash parse(string formatted)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

ID
enum string ID;
Undocumented in source.
MCF_PREFIX
enum string MCF_PREFIX;
Undocumented in source.

Inherited Members

From ModularCryptFormat

TOKEN_DELIMITER
enum string TOKEN_DELIMITER;
Undocumented in source.
getId
string getId()

Returns the Modular Crypt Format identifier that indicates how the formatted string should be parsed. This id is always in the MCF-formatted string's first token. <p/> Example values are {@code md5}, {@code 1}, {@code 2}, {@code apr1}, etc.

From ParsableHashFormat

parse
Hash parse(string formatted)

Parses the specified formatted string and returns the corresponding Hash instance.

Meta