| java.lang.Object com.quadcap.crypto.SHA1Digest
SHA1Digest | final public class SHA1Digest implements Digest(Code) | | 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.
|
Method Summary | |
final void | R0(int data, int v, int w, int x, int y, int z, int i) | final void | R1(int data, int v, int w, int x, int y, int z, int i) | final void | R2(int data, int v, int w, int x, int y, int z, int i) | final void | R3(int data, int v, int w, int x, int y, int z, int i) | final void | R4(int data, int v, int w, int x, int y, int z, int i) | final int | blk(int i) | final int | blk0(int i) | public byte[] | digest() | public String | getAlg() | public void | init() | public static void | main(String args) This is a test program for the SHA1 algorithm. | final int | rol(int value, int bits) | void | transform() Hash a single 512-bit block. | public void | update(byte b) Add one byte to the digest. | public void | update(byte[] b, int off, int len) | public void | update(byte[] buf) |
SHA1Digest | public SHA1Digest()(Code) | | Default constructor
|
R0 | final void R0(int data, int v, int w, int x, int y, int z, int i)(Code) | | |
R1 | final void R1(int data, int v, int w, int x, int y, int z, int i)(Code) | | |
R2 | final void R2(int data, int v, int w, int x, int y, int z, int i)(Code) | | |
R3 | final void R3(int data, int v, int w, int x, int y, int z, int i)(Code) | | |
R4 | final void R4(int data, int v, int w, int x, int y, int z, int i)(Code) | | |
blk0 | final int blk0(int i)(Code) | | |
digest | public byte[] digest()(Code) | | Return the message digest for the accumulated bytes
|
getAlg | public String getAlg()(Code) | | Return a string that identifies this algorithm
|
init | public void init()(Code) | | SHA1Init - Initialize new context
|
main | public static void main(String args)(Code) | | This is a test program for the SHA1 algorithm. It puts
the three test vectors through the algorithm and prints
out the results (they should match.) Then it runs the
MessageDigest benchmark method to see how fast it is.
on my P133 its about 110 - 120K bytes/second.
It then compares it to MD5, which is about 150K bytes/second.
|
rol | final int rol(int value, int bits)(Code) | | |
transform | void transform()(Code) | | 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.
|
update | public void update(byte b)(Code) | | 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.
|
update | public void update(byte[] b, int off, int len)(Code) | | Implementation for arrays just wraps the primitive byte operation
|
update | public void update(byte[] buf)(Code) | | And the full-array implementation is just a degenerate case of the
array-subset implementation:
|
|
|