org.clazzes.optional.sec
Class SHA1Digest
java.lang.Object
org.clazzes.optional.sec.GeneralDigest
org.clazzes.optional.sec.SHA1Digest
- All Implemented Interfaces:
- Digest
public class SHA1Digest
- extends GeneralDigest
implementation of SHA-1 as outlined in "Handbook of Applied Cryptography", pages 346 - 349.
It is interesting to ponder why the, apart from the extra IV, the other difference here from MD5
is the "endienness" of the word processing!
This class has been copied from bouncycastle.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DIGEST_LENGTH
public static final int DIGEST_LENGTH
- See Also:
- Constant Field Values
SHA1Digest
public SHA1Digest()
- Standard constructor
SHA1Digest
public SHA1Digest(SHA1Digest t)
- Copy constructor. This will copy the state of the provided
message digest.
cloneState
public Digest cloneState()
- Returns:
- A new digest in identical state. This is used, when you
want to calculate an intermediate digest value and continue
afterward with adding more content.
getAlgorithmName
public java.lang.String getAlgorithmName()
- Returns:
- The name of the digest algorithm.
getDigestSize
public int getDigestSize()
- Returns:
- The size of computed hashes.
processWord
protected void processWord(byte[] in,
int inOff)
- Specified by:
processWord
in class GeneralDigest
processLength
protected void processLength(long bitLength)
- Specified by:
processLength
in class GeneralDigest
doFinal
public int doFinal(byte[] out,
int outOff)
- Description copied from interface:
Digest
- Retrieve the hash of all data added so far with
Digest.update(byte[], int, int)
.
- Parameters:
out
- The buffer, where the computed hash will be stored.
Digest.getDigestSize()
bytes starting at off
will be written to hash
.outOff
- The offset at which the hash is stored.
- Returns:
- The number of bytes written, which is equal to
Digest.getDigestSize()
.
reset
public void reset()
- reset the chaining variables
- Specified by:
reset
in interface Digest
- Overrides:
reset
in class GeneralDigest
processBlock
protected void processBlock()
- Specified by:
processBlock
in class GeneralDigest
Copyright © 2010. All Rights Reserved.