|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.avis.security.SHA1
public final class SHA1
Implements the SHA-1 secure hash algorithm.
The FIPS PUB 180-2 standard specifies four secure hash algorithms (SHA-1, SHA-256, SHA-384 and SHA-512) for computing a condensed representation of electronic data (message). When a message of any length < 2^^64 bits (for SHA-1 and SHA-256) or < 2^^128 bits (for SHA-384 and SHA-512) is input to an algorithm, the result is an output called a message digest. The message digests range in length from 160 to 512 bits, depending on the algorithm. Secure hash algorithms are typically used with other cryptographic algorithms, such as digital signature algorithms and keyed-hash message authentication codes, or in the generation of random numbers (bits).
The four hash algorithms specified in this "SHS" standard are called secure because, for a given algorithm, it is computationally infeasible 1) to find a message that corresponds to a given message digest, or 2) to find two different messages that produce the same message digest. Any change to a message will, with a very high probability, result in a different message digest. This will result in a verification failure when the secure hash algorithm is used with a digital signature algorithm or a keyed-hash message authentication algorithm.
A "SHS change notice" adds a SHA-224 algorithm for interoperability, which, like SHA-1 and SHA-256, operates on 512-bit blocks and 32-bit words,
References:
Constructor Summary | |
---|---|
SHA1()
Creates a SHA1 object with default initial state. |
|
SHA1(SHA1 state)
Creates a SHA1 object with state (for cloning). |
Method Summary | |
---|---|
Object |
clone()
Clones this object. |
byte[] |
engineDigest()
Completes the hash computation by performing final operations such as padding. |
int |
engineDigest(byte[] hashvalue,
int offset,
int len)
Completes the hash computation by performing final operations such as padding. |
int |
engineGetDigestLength()
Returns the digest length in bytes. |
void |
engineUpdate(byte input)
Updates the digest using the specified byte. |
void |
engineUpdate(byte[] input,
int offset,
int len)
Updates the digest using the specified array of bytes, starting at the specified offset. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SHA1()
public SHA1(SHA1 state)
state
- the existing object to cloneMethod Detail |
---|
public Object clone()
clone
in class Object
public int engineGetDigestLength()
java.security.MessageDigestSpi
.
public void engineUpdate(byte input)
input
- the byte to use for the update.public void engineUpdate(byte[] input, int offset, int len)
input
- the array of bytes to use for the update.offset
- the offset to start from in the array of bytes.len
- the number of bytes to use, starting at offset.public byte[] engineDigest()
public int engineDigest(byte[] hashvalue, int offset, int len)
hashvalue
- the output buffer in which to store the digest.offset
- offset to start from in the output bufferlen
- number of bytes within buf allotted for the digest. Both this
default implementation and the SUN provider do not return partial
digests. The presence of this parameter is solely for consistency
in our API's. If the value of this parameter is less than the
actual digest length, the method will throw a DigestException.
This parameter is ignored if its value is greater than or equal to
the actual digest length.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |