blob: 7f589e1ca4333eedfb5d7eb43cea015c5d866628 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="fr">
<head>
<!-- Generated by javadoc (11.0.8) on Wed Oct 28 15:55:21 CET 2020 -->
<title>AbstractHash (Apache Shiro :: Cryptography 1.7.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2020-10-28">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AbstractHash (Apache Shiro :: Cryptography 1.7.0 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":42,"i1":38,"i2":42,"i3":42,"i4":42,"i5":42,"i6":42,"i7":42,"i8":42,"i9":42,"i10":42,"i11":42};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/AbstractHash.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" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.shiro.crypto.hash</a></div>
<h2 title="Class AbstractHash" class="title">Class AbstractHash</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.shiro.codec.CodecSupport</li>
<li>
<ul class="inheritance">
<li>org.apache.shiro.crypto.hash.AbstractHash</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a></code>, <code><a href="Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a></code>, <code>org.apache.shiro.util.ByteSource</code></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="SimpleHash.html" title="class in org.apache.shiro.crypto.hash">SimpleHash</a></code></dd>
</dl>
<hr>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang" class="externalLink">@Deprecated</a>
public abstract class <a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.46">AbstractHash</a>
extends org.apache.shiro.codec.CodecSupport
implements <a href="Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a></pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">in Shiro 1.1 in favor of using the concrete <a href="SimpleHash.html" title="class in org.apache.shiro.crypto.hash"><code>SimpleHash</code></a> implementation directly.</div>
</div>
<div class="block">Provides a base for all Shiro Hash algorithms with support for salts and multiple hash iterations.
<p/>
Read
<a href="http://www.owasp.org/index.php/Hashing_Java" target="blank">http://www.owasp.org/index.php/Hashing_Java</a>
for a good article on the benefits of hashing, including what a 'salt' is as well as why it and multiple hash
iterations can be useful.
<p/>
This class and its subclasses support hashing with additional capabilities of salting and multiple iterations via
overloaded constructors.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>0.9</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../serialized-form.html#org.apache.shiro.crypto.hash.AbstractHash">Serialized Form</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="nested.classes.inherited.from.class.org.apache.shiro.util.ByteSource">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface&nbsp;org.apache.shiro.util.ByteSource</h3>
<code>org.apache.shiro.util.ByteSource.Util</code></li>
</ul>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="fields.inherited.from.class.org.apache.shiro.codec.CodecSupport">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;org.apache.shiro.codec.CodecSupport</h3>
<code>PREFERRED_ENCODING</code></li>
</ul>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">AbstractHash</a></span>()</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates an new instance without any of its properties set (no hashing is performed).</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.Object)">AbstractHash</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;source)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates a hash of the specified <code>source</code> with no <code>salt</code> using a single hash iteration.</div>
</td>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.Object,java.lang.Object)">AbstractHash</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;source,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;salt)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates a hash of the specified <code>source</code> using the given <code>salt</code> using a single hash iteration.</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.Object,java.lang.Object,int)">AbstractHash</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;source,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;salt,
int&nbsp;hashIterations)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates a 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>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#equals(java.lang.Object)">equals</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;o)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns <code>true</code> if the specified object is a Hash and its <a href="#getBytes()"><code>byte array</code></a> is identical to
this Hash's byte array, <code>false</code> otherwise.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>abstract <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAlgorithmName()">getAlgorithmName</a></span>()</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Implemented by subclasses, this specifies the <a href="https://docs.oracle.com/javase/8/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security" class="externalLink"><code>MessageDigest</code></a> algorithm name
to use when performing the hash.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getBytes()">getBytes</a></span>()</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
&nbsp;</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security" class="externalLink">MessageDigest</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDigest(java.lang.String)">getDigest</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;algorithmName)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns the JDK MessageDigest instance to use for executing the hash.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>protected byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hash(byte%5B%5D)">hash</a></span>&#8203;(byte[]&nbsp;bytes)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Hashes the specified byte array without a salt for a single iteration.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>protected byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hash(byte%5B%5D,byte%5B%5D)">hash</a></span>&#8203;(byte[]&nbsp;bytes,
byte[]&nbsp;salt)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Hashes the specified byte array using the given <code>salt</code> for a single iteration.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>protected byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hash(byte%5B%5D,byte%5B%5D,int)">hash</a></span>&#8203;(byte[]&nbsp;bytes,
byte[]&nbsp;salt,
int&nbsp;hashIterations)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<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="i7" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hashCode()">hashCode</a></span>()</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Simply returns toHex().hashCode();</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setBytes(byte%5B%5D)">setBytes</a></span>&#8203;(byte[]&nbsp;alreadyHashedBytes)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Sets the raw bytes stored by this hash instance.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBase64()">toBase64</a></span>()</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns a Base64-encoded string of the underlying <a href="#getBytes()"><code>byte array</code></a>.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toHex()">toHex</a></span>()</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns a hex-encoded string of the underlying <a href="#getBytes()"><code>byte array</code></a>.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Simple implementation that merely returns <a href="#toHex()"><code>toHex()</code></a>.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.codec.CodecSupport">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;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 id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.util.ByteSource">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.shiro.util.ByteSource</h3>
<code>isEmpty</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.org.apache.shiro.crypto.hash.Hash">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.shiro.crypto.hash.<a href="Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a></h3>
<code><a href="Hash.html#getIterations()">getIterations</a>, <a href="Hash.html#getSalt()">getSalt</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AbstractHash</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.72">AbstractHash</a>()</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates an new instance without any of its properties set (no hashing is performed).
<p/>
Because all constructors in this class (except this one) hash the <code>source</code> constructor argument, this
default, no-arg 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 instantiating the instance with
this default, no-arg constructor, you can then immediately call <a href="#setBytes(byte%5B%5D)"><code>setBytes</code></a> to have a
fully-initialized instance.</div>
</li>
</ul>
<a id="&lt;init&gt;(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AbstractHash</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.88">AbstractHash</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;source)
throws org.apache.shiro.codec.CodecException</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates a hash of the specified <code>source</code> with no <code>salt</code> using a single hash iteration.
<p/>
It is a convenience constructor that merely executes <code>this( source, null, 1);</code>.
<p/>
Please see the
<a href="#%3Cinit%3E(java.lang.Object,java.lang.Object,int)"><code>AbstractHash(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>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>
</dl>
</li>
</ul>
<a id="&lt;init&gt;(java.lang.Object,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>AbstractHash</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.106">AbstractHash</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;source,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;salt)
throws org.apache.shiro.codec.CodecException</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates a 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( source, salt, 1);</code>.
<p/>
Please see the
<a href="#%3Cinit%3E(java.lang.Object,java.lang.Object,int)"><code>AbstractHash(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>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>
</dl>
</li>
</ul>
<a id="&lt;init&gt;(java.lang.Object,java.lang.Object,int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>AbstractHash</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.129">AbstractHash</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;source,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;salt,
int&nbsp;hashIterations)
throws org.apache.shiro.codec.CodecException</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Creates a 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/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>String</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io" class="externalLink"><code>File</code></a>, or
<a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io" class="externalLink"><code>InputStream</code></a>. 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 three supported types first before passing them in to this
constructor}.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<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>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getAlgorithmName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAlgorithmName</h4>
<pre class="methodSignature">public abstract&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.145">getAlgorithmName</a>()</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Implemented by subclasses, this specifies the <a href="https://docs.oracle.com/javase/8/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security" class="externalLink"><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="Hash.html#getAlgorithmName()">getAlgorithmName</a></code>&nbsp;in interface&nbsp;<code><a href="Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the <a href="https://docs.oracle.com/javase/8/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security" class="externalLink"><code>MessageDigest</code></a> algorithm name to use when performing the hash.</dd>
</dl>
</li>
</ul>
<a id="getBytes()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBytes</h4>
<pre class="methodSignature">public&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.147">getBytes</a>()</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>getBytes</code>&nbsp;in interface&nbsp;<code>org.apache.shiro.util.ByteSource</code></dd>
</dl>
</li>
</ul>
<a id="setBytes(byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setBytes</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.159">setBytes</a>&#8203;(byte[]&nbsp;alreadyHashedBytes)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<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="paramLabel">Parameters:</span></dt>
<dd><code>alreadyHashedBytes</code> - the raw already-hashed bytes to store in this instance.</dd>
</dl>
</li>
</ul>
<a id="getDigest(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDigest</h4>
<pre class="methodSignature">protected&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security" class="externalLink">MessageDigest</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.172">getDigest</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;algorithmName)
throws <a href="../UnknownAlgorithmException.html" title="class in org.apache.shiro.crypto">UnknownAlgorithmException</a></pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns the JDK MessageDigest instance to use for executing the hash.</div>
<dl>
<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><a href="../UnknownAlgorithmException.html" title="class in org.apache.shiro.crypto">UnknownAlgorithmException</a></code> - if the specified algorithm name is not available.</dd>
</dl>
</li>
</ul>
<a id="hash(byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hash</h4>
<pre class="methodSignature">protected&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.187">hash</a>&#8203;(byte[]&nbsp;bytes)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Hashes the specified byte array without a salt for a single iteration.</div>
<dl>
<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>
</dl>
</li>
</ul>
<a id="hash(byte[],byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hash</h4>
<pre class="methodSignature">protected&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.198">hash</a>&#8203;(byte[]&nbsp;bytes,
byte[]&nbsp;salt)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Hashes the specified byte array using the given <code>salt</code> for a single iteration.</div>
<dl>
<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>
</dl>
</li>
</ul>
<a id="hash(byte[],byte[],int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hash</h4>
<pre class="methodSignature">protected&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.211">hash</a>&#8203;(byte[]&nbsp;bytes,
byte[]&nbsp;salt,
int&nbsp;hashIterations)
throws <a href="../UnknownAlgorithmException.html" title="class in org.apache.shiro.crypto">UnknownAlgorithmException</a></pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<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="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><a href="../UnknownAlgorithmException.html" title="class in org.apache.shiro.crypto">UnknownAlgorithmException</a></code> - if the <a href="#getAlgorithmName()"><code>algorithmName</code></a> is not available.</dd>
</dl>
</li>
</ul>
<a id="toHex()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toHex</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.236">toHex</a>()</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns a hex-encoded string of the underlying <a href="#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="#setBytes(byte%5B%5D)"><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>&nbsp;in interface&nbsp;<code>org.apache.shiro.util.ByteSource</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a hex-encoded string of the underlying <a href="#getBytes()"><code>byte array</code></a>.</dd>
</dl>
</li>
</ul>
<a id="toBase64()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBase64</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.252">toBase64</a>()</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns a Base64-encoded string of the underlying <a href="#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="#setBytes(byte%5B%5D)"><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>&nbsp;in interface&nbsp;<code>org.apache.shiro.util.ByteSource</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Base64-encoded string of the underlying <a href="#getBytes()"><code>byte array</code></a>.</dd>
</dl>
</li>
</ul>
<a id="toString()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.265">toString</a>()</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Simple implementation that merely returns <a href="#toHex()"><code>toHex()</code></a>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the <a href="#toHex()"><code>toHex()</code></a> value.</dd>
</dl>
</li>
</ul>
<a id="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.277">equals</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;o)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Returns <code>true</code> if the specified object is a Hash and its <a href="#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="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</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="#getBytes()"><code>byte array</code></a> is identical to
this Hash's byte array, <code>false</code> otherwise.</dd>
</dl>
</li>
</ul>
<a id="hashCode()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>hashCode</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/shiro/crypto/hash/AbstractHash.html#line.290">hashCode</a>()</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span></div>
<div class="block">Simply returns toHex().hashCode();</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>toHex().hashCode()</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/AbstractHash.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" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>