Package org.apache.shiro.crypto.hash
Interface HashRequest
-
- All Known Implementing Classes:
SimpleHashRequest
public interface HashRequest
AHashRequest
is composed of data that will be used by aHashService
to compute a hash (aka 'digest'). While you can instantiate a concreteHashRequest
class directly, most will find using theHashRequest.Builder
more convenient.- Since:
- 1.2
- See Also:
HashRequest.Builder
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
HashRequest.Builder
A Builder class representing the Builder design pattern for constructingHashRequest
instances.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getAlgorithmName()
Returns the name of the hash algorithm theHashService
should use when computing theHash
, ornull
if the default algorithm configuration of theHashService
should be used.int
getIterations()
Returns the number of requested hash iterations to be performed when computing the finalHash
result.ByteSource
getSalt()
Returns a salt to be used by theHashService
during hash computation, ornull
if no salt is provided as part of the request.ByteSource
getSource()
Returns the source data that will be hashed by aHashService
.
-
-
-
Method Detail
-
getSource
ByteSource getSource()
Returns the source data that will be hashed by aHashService
. For example, this might be aByteSource
representation of a password, or file, etc.- Returns:
- the source data that will be hashed by a
HashService
.
-
getSalt
ByteSource getSalt()
Returns a salt to be used by theHashService
during hash computation, ornull
if no salt is provided as part of the request. Note that anull
value does not necessarily mean a salt won't be used at all - it just means that the request didn't include one. The servicingHashService
is free to provide a salting strategy for a request, even if the request did not specify one.- Returns:
- a salt to be used by the
HashService
during hash computation, ornull
if no salt is provided as part of the request.
-
getIterations
int getIterations()
Returns the number of requested hash iterations to be performed when computing the finalHash
result. A non-positive (0 or less) indicates that theHashService
's default iteration configuration should be used. A positive value overrides theHashService
's configuration for a single request. Note that aHashService
is free to ignore this number if it determines the number is not sufficient to meet a desired level of security.- Returns:
- the number of requested hash iterations to be performed when computing the final
Hash
result.
-
getAlgorithmName
String getAlgorithmName()
Returns the name of the hash algorithm theHashService
should use when computing theHash
, ornull
if the default algorithm configuration of theHashService
should be used. A non-null value overrides theHashService
's configuration for a single request. Note that aHashService
is free to ignore this value if it determines that the algorithm is not sufficient to meet a desired level of security.- Returns:
- the name of the hash algorithm the
HashService
should use when computing theHash
, ornull
if the default algorithm configuration of theHashService
should be used.
-
-