java.lang.Object
com.ssttr.crypto.MessageDigest
com.ssttr.crypto.SHA1
- public final class SHA1
- extends MessageDigest
This is a simple port of Steve Reid's SHA-1 code into Java.
I've run his test vectors through the code and they all pass.
|
Constructor Summary |
SHA1()
|
|
Method Summary |
(package private) int |
blk(int i)
|
(package private) int |
blk0(int i)
|
void |
finish()
Complete processing on the message digest. |
java.lang.String |
getAlg()
Return a string that identifies this algorithm |
void |
init()
SHA1Init - Initialize new context |
(package private) void |
R0(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
|
(package private) void |
R1(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
|
(package private) void |
R2(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
|
(package private) void |
R3(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
|
(package private) void |
R4(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
|
(package private) int |
rol(int value,
int bits)
|
(package private) void |
transform()
Hash a single 512-bit block. |
void |
update(byte b)
Add one byte to the digest. |
| Methods inherited from class com.ssttr.crypto.MessageDigest |
benchmark, computeDigest, computeDigest, getDigest, getDigestBytes, getDigestHex, isEqual, isEqual, toString, update, update, update, update, update, update, update, update, update, update, update, updateASCII |
state
private int[] state
count
private long count
block
private int[] block
blockIndex
private int blockIndex
dd
int[] dd
SHA1
public SHA1()
rol
final int rol(int value,
int bits)
blk0
final int blk0(int i)
blk
final int blk(int i)
R0
final void R0(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
R1
final void R1(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
R2
final void R2(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
R3
final void R3(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
R4
final void R4(int[] data,
int v,
int w,
int x,
int y,
int z,
int i)
transform
void transform()
- Hash a single 512-bit block. This is the core of the algorithm.
Note that working with arrays is very inefficent in Java as it
does a class cast check each time you store into the array.
init
public void init()
- SHA1Init - Initialize new context
- Specified by:
init in class MessageDigest
update
public void update(byte b)
- Add one byte to the digest. When this is implemented
all of the abstract class methods end up calling
this method for types other than bytes.
- Specified by:
update in class MessageDigest
finish
public void finish()
- Complete processing on the message digest.
- Specified by:
finish in class MessageDigest
getAlg
public java.lang.String getAlg()
- Return a string that identifies this algorithm
- Specified by:
getAlg in class MessageDigest