|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.shiro.crypto.hash.SimpleHashRequest
public class SimpleHashRequest
Simple implementation of HashRequest
that can be used when interacting with a HashService
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.shiro.crypto.hash.HashRequest |
---|
HashRequest.Builder |
Constructor Summary | |
---|---|
SimpleHashRequest(String algorithmName,
ByteSource source,
ByteSource salt,
int iterations)
Creates a new SimpleHashRequest instance. |
Method Summary | |
---|---|
String |
getAlgorithmName()
Returns the name of the hash algorithm the HashService should use when computing the Hash , or
null if the default algorithm configuration of the HashService should be used. |
int |
getIterations()
Returns the number of requested hash iterations to be performed when computing the final Hash result. |
ByteSource |
getSalt()
Returns a salt to be used by the HashService during hash computation, or null if no salt is
provided as part of the request. |
ByteSource |
getSource()
Returns the source data that will be hashed by a HashService . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleHashRequest(String algorithmName, ByteSource source, ByteSource salt, int iterations)
algorithmName
- the name of the hash algorithm to use. This is often null as the
HashService
implementation is usually configured with an appropriate algorithm name, but this
can be non-null if the hash service's algorithm should be overridden with a specific one for the duration
of the request.source
- the source to be hashedsalt
- any public salt which should be used when computing the hashiterations
- the number of hash iterations to execute. Zero (0) indicates no iterations were specified
for the request, at which point the number of iterations is decided by the HashService
NullPointerException
- if source
is null or empty.Method Detail |
---|
public ByteSource getSource()
HashRequest
HashService
. For example, this might be a
ByteSource
representation of a password, or file, etc.
getSource
in interface HashRequest
HashService
.public ByteSource getSalt()
HashRequest
HashService
during hash computation, or null
if no salt is
provided as part of the request.
Note that a null
value does not necessarily mean a salt won't be used at all - it just
means that the request didn't include one. The servicing HashService
is free to provide a salting
strategy for a request, even if the request did not specify one.
getSalt
in interface HashRequest
HashService
during hash computation, or null
if no salt is
provided as part of the request.public int getIterations()
HashRequest
Hash
result.
A non-positive (0 or less) indicates that the HashService
's default iteration configuration should
be used. A positive value overrides the HashService
's configuration for a single request.
Note that a HashService
is free to ignore this number if it determines the number is not sufficient
to meet a desired level of security.
getIterations
in interface HashRequest
Hash
result.public String getAlgorithmName()
HashRequest
HashService
should use when computing the Hash
, or
null
if the default algorithm configuration of the HashService
should be used. A non-null value
overrides the HashService
's configuration for a single request.
Note that a HashService
is free to ignore this value if it determines that the algorithm is not
sufficient to meet a desired level of security.
getAlgorithmName
in interface HashRequest
HashService
should use when computing the Hash
, or
null
if the default algorithm configuration of the HashService
should be used.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |