| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="fr"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_201) on Sat May 02 22:21:25 CEST 2020 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>SimpleHash (Apache Shiro :: Cryptography :: Hashing 1.5.3 API)</title> |
| <meta name="date" content="2020-05-02"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="SimpleHash (Apache Shiro :: Cryptography :: Hashing 1.5.3 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SimpleHash.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/shiro/crypto/hash/Sha512Hash.html" title="class in org.apache.shiro.crypto.hash"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHashRequest.html" title="class in org.apache.shiro.crypto.hash"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/shiro/crypto/hash/SimpleHash.html" target="_top">Frames</a></li> |
| <li><a href="SimpleHash.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#fields.inherited.from.class.org.apache.shiro.codec.CodecSupport">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.shiro.crypto.hash</div> |
| <h2 title="Class SimpleHash" class="title">Class SimpleHash</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.shiro.codec.CodecSupport</li> |
| <li> |
| <ul class="inheritance"> |
| <li><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">org.apache.shiro.crypto.hash.AbstractHash</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.shiro.crypto.hash.SimpleHash</li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="https://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>, <a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a>, org.apache.shiro.util.ByteSource</dd> |
| </dl> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><a href="../../../../../org/apache/shiro/crypto/hash/Md2Hash.html" title="class in org.apache.shiro.crypto.hash">Md2Hash</a>, <a href="../../../../../org/apache/shiro/crypto/hash/Md5Hash.html" title="class in org.apache.shiro.crypto.hash">Md5Hash</a>, <a href="../../../../../org/apache/shiro/crypto/hash/Sha1Hash.html" title="class in org.apache.shiro.crypto.hash">Sha1Hash</a>, <a href="../../../../../org/apache/shiro/crypto/hash/Sha256Hash.html" title="class in org.apache.shiro.crypto.hash">Sha256Hash</a>, <a href="../../../../../org/apache/shiro/crypto/hash/Sha384Hash.html" title="class in org.apache.shiro.crypto.hash">Sha384Hash</a>, <a href="../../../../../org/apache/shiro/crypto/hash/Sha512Hash.html" title="class in org.apache.shiro.crypto.hash">Sha512Hash</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.43">SimpleHash</a> |
| extends <a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></pre> |
| <div class="block">A <code>Hash</code> implementation that allows any <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to |
| be used. This class is a less type-safe variant than the other <code>AbstractHash</code> subclasses |
| (e.g. <a href="../../../../../org/apache/shiro/crypto/hash/Sha512Hash.html" title="class in org.apache.shiro.crypto.hash"><code>Sha512Hash</code></a>, etc), but it does allow for any algorithm name to be specified in case the other subclass |
| implementations do not represent an algorithm that you may want to use. |
| <p/> |
| As of Shiro 1.1, this class effectively replaces the (now-deprecated) <a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash"><code>AbstractHash</code></a> class. It subclasses |
| <code>AbstractHash</code> only to retain backwards-compatibility.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.1</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../serialized-form.html#org.apache.shiro.crypto.hash.SimpleHash">Serialized Form</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.classes.inherited.from.class.org.apache.shiro.util.ByteSource"> |
| <!-- --> |
| </a> |
| <h3>Nested classes/interfaces inherited from interface org.apache.shiro.util.ByteSource</h3> |
| <code>org.apache.shiro.util.ByteSource.Util</code></li> |
| </ul> |
| </li> |
| </ul> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <ul class="blockList"> |
| <li class="blockList"><a name="fields.inherited.from.class.org.apache.shiro.codec.CodecSupport"> |
| <!-- --> |
| </a> |
| <h3>Fields inherited from class org.apache.shiro.codec.CodecSupport</h3> |
| <code>PREFERRED_ENCODING</code></li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#SimpleHash-java.lang.String-">SimpleHash</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName)</code> |
| <div class="block">Creates an new instance with only its <code>algorithmName</code> set - no hashing is performed.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#SimpleHash-java.lang.String-java.lang.Object-">SimpleHash</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source)</code> |
| <div class="block">Creates an <code>algorithmName</code>-specific hash of the specified <code>source</code> with no <code>salt</code> using a |
| single hash iteration.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#SimpleHash-java.lang.String-java.lang.Object-java.lang.Object-">SimpleHash</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> salt)</code> |
| <div class="block">Creates an <code>algorithmName</code>-specific hash of the specified <code>source</code> using the given <code>salt</code> |
| using a single hash iteration.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#SimpleHash-java.lang.String-java.lang.Object-java.lang.Object-int-">SimpleHash</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> salt, |
| int hashIterations)</code> |
| <div class="block">Creates an <code>algorithmName</code>-specific hash of the specified <code>source</code> using the given |
| <code>salt</code> a total of <code>hashIterations</code> times.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>protected org.apache.shiro.util.ByteSource</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#convertSaltToBytes-java.lang.Object-">convertSaltToBytes</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> salt)</code> |
| <div class="block">Acquires the specified <code>salt</code> argument's bytes and returns them in the form of a <code>ByteSource</code> instance.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>protected org.apache.shiro.util.ByteSource</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#convertSourceToBytes-java.lang.Object-">convertSourceToBytes</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source)</code> |
| <div class="block">Acquires the specified <code>source</code> argument's bytes and returns them in the form of a <code>ByteSource</code> instance.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#equals-java.lang.Object-">equals</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</code> |
| <div class="block">Returns <code>true</code> if the specified object is a Hash and its <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a> is identical to |
| this Hash's byte array, <code>false</code> otherwise.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getAlgorithmName--">getAlgorithmName</a></span>()</code> |
| <div class="block">Returns the <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to use when performing the hash.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--">getBytes</a></span>()</code> </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getDigest-java.lang.String-">getDigest</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName)</code> |
| <div class="block">Returns the JDK MessageDigest instance to use for executing the hash.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getIterations--">getIterations</a></span>()</code> |
| <div class="block">Returns the number of hash iterations used to compute the hash.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>org.apache.shiro.util.ByteSource</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getSalt--">getSalt</a></span>()</code> |
| <div class="block">Returns a salt used to compute the hash or <code>null</code> if no salt was used.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>protected byte[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#hash-byte:A-">hash</a></span>(byte[] bytes)</code> |
| <div class="block">Hashes the specified byte array without a salt for a single iteration.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>protected byte[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#hash-byte:A-byte:A-">hash</a></span>(byte[] bytes, |
| byte[] salt)</code> |
| <div class="block">Hashes the specified byte array using the given <code>salt</code> for a single iteration.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>protected byte[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#hash-byte:A-byte:A-int-">hash</a></span>(byte[] bytes, |
| byte[] salt, |
| int hashIterations)</code> |
| <div class="block">Hashes the specified byte array using the given <code>salt</code> for the specified number of iterations.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#hashCode--">hashCode</a></span>()</code> |
| <div class="block">Simply returns toHex().hashCode();</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#isEmpty--">isEmpty</a></span>()</code> </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#setBytes-byte:A-">setBytes</a></span>(byte[] alreadyHashedBytes)</code> |
| <div class="block">Sets the raw bytes stored by this hash instance.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#setIterations-int-">setIterations</a></span>(int iterations)</code> |
| <div class="block">Sets the iterations used to previously compute AN ALREADY GENERATED HASH.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#setSalt-org.apache.shiro.util.ByteSource-">setSalt</a></span>(org.apache.shiro.util.ByteSource salt)</code> |
| <div class="block">Sets the salt used to previously compute AN ALREADY GENERATED HASH.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toBase64--">toBase64</a></span>()</code> |
| <div class="block">Returns a Base64-encoded string of the underlying <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>protected org.apache.shiro.util.ByteSource</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toByteSource-java.lang.Object-">toByteSource</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</code> |
| <div class="block">Converts a given object into a <code>ByteSource</code> instance.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toHex--">toHex</a></span>()</code> |
| <div class="block">Returns a hex-encoded string of the underlying <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toString--">toString</a></span>()</code> |
| <div class="block">Simple implementation that merely returns <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toHex--"><code>toHex()</code></a>.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.org.apache.shiro.codec.CodecSupport"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class org.apache.shiro.codec.CodecSupport</h3> |
| <code>isByteSource, objectToBytes, objectToString, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toBytes, toChars, toChars, toString, toString, toString</code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="SimpleHash-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>public <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.92">SimpleHash</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName)</pre> |
| <div class="block">Creates an new instance with only its <code>algorithmName</code> set - no hashing is performed. |
| <p/> |
| Because all other constructors in this class hash the <code>source</code> constructor argument, this |
| constructor is useful in scenarios when you have a byte array that you know is already hashed and |
| just want to set the bytes in their raw form directly on an instance. After using this constructor, |
| you can then immediately call <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#setBytes-byte:A-"><code>setBytes</code></a> to have a fully-initialized instance. |
| <p/> |
| <b>N.B.</b>The algorithm identified by the <code>algorithmName</code> parameter must be available on the JVM. If it |
| is not, a <code>UnknownAlgorithmException</code> will be thrown when the hash is performed (not at instantiation).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>algorithmName</code> - the <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to use when |
| performing the hash.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><code>UnknownAlgorithmException</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="SimpleHash-java.lang.String-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>public <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.115">SimpleHash</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source) |
| throws org.apache.shiro.codec.CodecException, |
| org.apache.shiro.crypto.UnknownAlgorithmException</pre> |
| <div class="block">Creates an <code>algorithmName</code>-specific hash of the specified <code>source</code> with no <code>salt</code> using a |
| single hash iteration. |
| <p/> |
| This is a convenience constructor that merely executes <code>this( algorithmName, source, null, 1);</code>. |
| <p/> |
| Please see the |
| <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#SimpleHash-java.lang.String-java.lang.Object-java.lang.Object-int-"><code>SimpleHashHash(algorithmName, Object,Object,int)</code></a> |
| constructor for the types of Objects that may be passed into this constructor, as well as how to support further |
| types.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>algorithmName</code> - the <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to use when |
| performing the hash.</dd> |
| <dd><code>source</code> - the object to be hashed.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>org.apache.shiro.codec.CodecException</code> - if the specified <code>source</code> cannot be converted into a byte array (byte[]).</dd> |
| <dd><code>org.apache.shiro.crypto.UnknownAlgorithmException</code> - if the <code>algorithmName</code> is not available.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="SimpleHash-java.lang.String-java.lang.Object-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>public <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.138">SimpleHash</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> salt) |
| throws org.apache.shiro.codec.CodecException, |
| org.apache.shiro.crypto.UnknownAlgorithmException</pre> |
| <div class="block">Creates an <code>algorithmName</code>-specific hash of the specified <code>source</code> using the given <code>salt</code> |
| using a single hash iteration. |
| <p/> |
| It is a convenience constructor that merely executes <code>this( algorithmName, source, salt, 1);</code>. |
| <p/> |
| Please see the |
| <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#SimpleHash-java.lang.String-java.lang.Object-java.lang.Object-int-"><code>SimpleHashHash(algorithmName, Object,Object,int)</code></a> |
| constructor for the types of Objects that may be passed into this constructor, as well as how to support further |
| types.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>algorithmName</code> - the <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to use when |
| performing the hash.</dd> |
| <dd><code>source</code> - the source object to be hashed.</dd> |
| <dd><code>salt</code> - the salt to use for the hash</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>org.apache.shiro.codec.CodecException</code> - if either constructor argument cannot be converted into a byte array.</dd> |
| <dd><code>org.apache.shiro.crypto.UnknownAlgorithmException</code> - if the <code>algorithmName</code> is not available.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="SimpleHash-java.lang.String-java.lang.Object-java.lang.Object-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>SimpleHash</h4> |
| <pre>public <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.165">SimpleHash</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> salt, |
| int hashIterations) |
| throws org.apache.shiro.codec.CodecException, |
| org.apache.shiro.crypto.UnknownAlgorithmException</pre> |
| <div class="block">Creates an <code>algorithmName</code>-specific hash of the specified <code>source</code> using the given |
| <code>salt</code> a total of <code>hashIterations</code> times. |
| <p/> |
| By default, this class only supports Object method arguments of |
| type <code>byte[]</code>, <code>char[]</code>, <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang"><code>String</code></a>, <a href="https://docs.oracle.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><code>File</code></a>, |
| <a href="https://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a> or <code>ByteSource</code>. If either |
| argument is anything other than these types a <code>CodecException</code> |
| will be thrown. |
| <p/> |
| If you want to be able to hash other object types, or use other salt types, you need to override the |
| <code>toBytes(Object)</code> method to support those specific types. Your other option is to |
| convert your arguments to one of the default supported types first before passing them in to this |
| constructor}.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>algorithmName</code> - the <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to use when |
| performing the hash.</dd> |
| <dd><code>source</code> - the source object to be hashed.</dd> |
| <dd><code>salt</code> - the salt to use for the hash</dd> |
| <dd><code>hashIterations</code> - the number of times the <code>source</code> argument hashed for attack resiliency.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>org.apache.shiro.codec.CodecException</code> - if either Object constructor argument cannot be converted into a byte array.</dd> |
| <dd><code>org.apache.shiro.crypto.UnknownAlgorithmException</code> - if the <code>algorithmName</code> is not available.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="convertSourceToBytes-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>convertSourceToBytes</h4> |
| <pre>protected org.apache.shiro.util.ByteSource <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.191">convertSourceToBytes</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> source)</pre> |
| <div class="block">Acquires the specified <code>source</code> argument's bytes and returns them in the form of a <code>ByteSource</code> instance. |
| <p/> |
| This implementation merely delegates to the convenience <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toByteSource-java.lang.Object-"><code>toByteSource(Object)</code></a> method for generic |
| conversion. Can be overridden by subclasses for source-specific conversion.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>source</code> - the source object to be hashed.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the source's bytes in the form of a <code>ByteSource</code> instance.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.2</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="convertSaltToBytes-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>convertSaltToBytes</h4> |
| <pre>protected org.apache.shiro.util.ByteSource <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.205">convertSaltToBytes</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> salt)</pre> |
| <div class="block">Acquires the specified <code>salt</code> argument's bytes and returns them in the form of a <code>ByteSource</code> instance. |
| <p/> |
| This implementation merely delegates to the convenience <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toByteSource-java.lang.Object-"><code>toByteSource(Object)</code></a> method for generic |
| conversion. Can be overridden by subclasses for salt-specific conversion.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>salt</code> - the salt to be use for the hash.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the salt's bytes in the form of a <code>ByteSource</code> instance.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.2</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toByteSource-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toByteSource</h4> |
| <pre>protected org.apache.shiro.util.ByteSource <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.216">toByteSource</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</pre> |
| <div class="block">Converts a given object into a <code>ByteSource</code> instance. Assumes the object can be converted to bytes.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>o</code> - the Object to convert into a <code>ByteSource</code> instance.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <code>ByteSource</code> representation of the specified object's bytes.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.2</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getAlgorithmName--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getAlgorithmName</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.238">getAlgorithmName</a>()</pre> |
| <div class="block">Returns the <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to use when performing the hash.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/Hash.html#getAlgorithmName--">getAlgorithmName</a></code> in interface <code><a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a></code></dd> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#getAlgorithmName--">getAlgorithmName</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security"><code>MessageDigest</code></a> algorithm name to use when performing the hash.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getSalt--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSalt</h4> |
| <pre>public org.apache.shiro.util.ByteSource <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.242">getSalt</a>()</pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../../org/apache/shiro/crypto/hash/Hash.html#getSalt--">Hash</a></code></span></div> |
| <div class="block">Returns a salt used to compute the hash or <code>null</code> if no salt was used.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a salt used to compute the hash or <code>null</code> if no salt was used.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getIterations--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getIterations</h4> |
| <pre>public int <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.246">getIterations</a>()</pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../../org/apache/shiro/crypto/hash/Hash.html#getIterations--">Hash</a></code></span></div> |
| <div class="block">Returns the number of hash iterations used to compute the hash.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of hash iterations used to compute the hash.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getBytes--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getBytes</h4> |
| <pre>public byte[] <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.250">getBytes</a>()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>getBytes</code> in interface <code>org.apache.shiro.util.ByteSource</code></dd> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#getBytes--">getBytes</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setBytes-byte:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setBytes</h4> |
| <pre>public void <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.262">setBytes</a>(byte[] alreadyHashedBytes)</pre> |
| <div class="block">Sets the raw bytes stored by this hash instance. |
| <p/> |
| The bytes are kept in raw form - they will not be hashed/changed. This is primarily a utility method for |
| constructing a Hash instance when the hashed value is already known.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#setBytes-byte:A-">setBytes</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>alreadyHashedBytes</code> - the raw already-hashed bytes to store in this instance.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setIterations-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setIterations</h4> |
| <pre>public void <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.277">setIterations</a>(int iterations)</pre> |
| <div class="block">Sets the iterations used to previously compute AN ALREADY GENERATED HASH. |
| <p/> |
| This is provided <em>ONLY</em> to reconstitute an already-created Hash instance. It should ONLY ever be |
| invoked when re-constructing a hash instance from an already-hashed value.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>iterations</code> - the number of hash iterations used to previously create the hash/digest.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.2</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setSalt-org.apache.shiro.util.ByteSource-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setSalt</h4> |
| <pre>public void <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.290">setSalt</a>(org.apache.shiro.util.ByteSource salt)</pre> |
| <div class="block">Sets the salt used to previously compute AN ALREADY GENERATED HASH. |
| <p/> |
| This is provided <em>ONLY</em> to reconstitute a Hash instance that has already been computed. It should ONLY |
| ever be invoked when re-constructing a hash instance from an already-hashed value.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>salt</code> - the salt used to previously create the hash/digest.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.2</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getDigest-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getDigest</h4> |
| <pre>protected <a href="https://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</a> <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.301">getDigest</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> algorithmName) |
| throws org.apache.shiro.crypto.UnknownAlgorithmException</pre> |
| <div class="block">Returns the JDK MessageDigest instance to use for executing the hash.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#getDigest-java.lang.String-">getDigest</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>algorithmName</code> - the algorithm to use for the hash, provided by subclasses.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the MessageDigest object for the specified <code>algorithm</code>.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>org.apache.shiro.crypto.UnknownAlgorithmException</code> - if the specified algorithm name is not available.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hash-byte:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hash</h4> |
| <pre>protected byte[] <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.317">hash</a>(byte[] bytes) |
| throws org.apache.shiro.crypto.UnknownAlgorithmException</pre> |
| <div class="block">Hashes the specified byte array without a salt for a single iteration.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#hash-byte:A-">hash</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>bytes</code> - the bytes to hash.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the hashed bytes.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>org.apache.shiro.crypto.UnknownAlgorithmException</code> - if the configured <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getAlgorithmName--"><code>algorithmName</code></a> is not available.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hash-byte:A-byte:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hash</h4> |
| <pre>protected byte[] <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.329">hash</a>(byte[] bytes, |
| byte[] salt) |
| throws org.apache.shiro.crypto.UnknownAlgorithmException</pre> |
| <div class="block">Hashes the specified byte array using the given <code>salt</code> for a single iteration.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#hash-byte:A-byte:A-">hash</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>bytes</code> - the bytes to hash</dd> |
| <dd><code>salt</code> - the salt to use for the initial hash</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the hashed bytes</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>org.apache.shiro.crypto.UnknownAlgorithmException</code> - if the configured <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getAlgorithmName--"><code>algorithmName</code></a> is not available.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hash-byte:A-byte:A-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hash</h4> |
| <pre>protected byte[] <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.342">hash</a>(byte[] bytes, |
| byte[] salt, |
| int hashIterations) |
| throws org.apache.shiro.crypto.UnknownAlgorithmException</pre> |
| <div class="block">Hashes the specified byte array using the given <code>salt</code> for the specified number of iterations.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#hash-byte:A-byte:A-int-">hash</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>bytes</code> - the bytes to hash</dd> |
| <dd><code>salt</code> - the salt to use for the initial hash</dd> |
| <dd><code>hashIterations</code> - the number of times the the <code>bytes</code> will be hashed (for attack resiliency).</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the hashed bytes.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>org.apache.shiro.crypto.UnknownAlgorithmException</code> - if the <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getAlgorithmName--"><code>algorithmName</code></a> is not available.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isEmpty--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isEmpty</h4> |
| <pre>public boolean <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.358">isEmpty</a>()</pre> |
| </li> |
| </ul> |
| <a name="toHex--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toHex</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.371">toHex</a>()</pre> |
| <div class="block">Returns a hex-encoded string of the underlying <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a>. |
| <p/> |
| This implementation caches the resulting hex string so multiple calls to this method remain efficient. |
| However, calling <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#setBytes-byte:A-"><code>setBytes</code></a> will null the cached value, forcing it to be recalculated the |
| next time this method is called.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>toHex</code> in interface <code>org.apache.shiro.util.ByteSource</code></dd> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#toHex--">toHex</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a hex-encoded string of the underlying <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toBase64--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toBase64</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.387">toBase64</a>()</pre> |
| <div class="block">Returns a Base64-encoded string of the underlying <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a>. |
| <p/> |
| This implementation caches the resulting Base64 string so multiple calls to this method remain efficient. |
| However, calling <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#setBytes-byte:A-"><code>setBytes</code></a> will null the cached value, forcing it to be recalculated the |
| next time this method is called.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>toBase64</code> in interface <code>org.apache.shiro.util.ByteSource</code></dd> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#toBase64--">toBase64</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a Base64-encoded string of the underlying <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toString--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.400">toString</a>()</pre> |
| <div class="block">Simple implementation that merely returns <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toHex--"><code>toHex()</code></a>.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#toString--">toString</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#toHex--"><code>toHex()</code></a> value.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="equals-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>equals</h4> |
| <pre>public boolean <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.412">equals</a>(<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</pre> |
| <div class="block">Returns <code>true</code> if the specified object is a Hash and its <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a> is identical to |
| this Hash's byte array, <code>false</code> otherwise.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#equals-java.lang.Object-">equals</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>o</code> - the object (Hash) to check for equality.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> if the specified object is a Hash and its <a href="../../../../../org/apache/shiro/crypto/hash/SimpleHash.html#getBytes--"><code>byte array</code></a> is identical to |
| this Hash's byte array, <code>false</code> otherwise.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hashCode--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>hashCode</h4> |
| <pre>public int <a href="../../../../../src-html/org/apache/shiro/crypto/hash/SimpleHash.html#line.425">hashCode</a>()</pre> |
| <div class="block">Simply returns toHex().hashCode();</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html#hashCode--">hashCode</a></code> in class <code><a href="../../../../../org/apache/shiro/crypto/hash/AbstractHash.html" title="class in org.apache.shiro.crypto.hash">AbstractHash</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>toHex().hashCode()</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SimpleHash.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/shiro/crypto/hash/Sha512Hash.html" title="class in org.apache.shiro.crypto.hash"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/shiro/crypto/hash/SimpleHashRequest.html" title="class in org.apache.shiro.crypto.hash"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/shiro/crypto/hash/SimpleHash.html" target="_top">Frames</a></li> |
| <li><a href="SimpleHash.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#fields.inherited.from.class.org.apache.shiro.codec.CodecSupport">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2004–2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |