com.arsdigita.acs.util.crypt
Class SHA1
java.lang.Object
|
+--com.arsdigita.acs.util.crypt.MessageDigest
|
+--com.arsdigita.acs.util.crypt.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.
|
Field Summary |
static java.lang.String |
cvsId
|
|
Constructor Summary |
SHA1()
|
|
Method Summary |
java.lang.String |
digout()
Print out the digest in a form that can be easily compared
to the test vectors. |
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 |
static void |
main(java.lang.String[] args)
This is a test program for the SHA1 algorithm. |
void |
update(byte b)
Add one byte to the digest. |
| Methods inherited from class com.arsdigita.acs.util.crypt.MessageDigest |
benchmark, computeDigest, computeDigest, isEqual, isEqual, toString, update, update, update, update, update, update, update, update, update, update, update, updateASCII |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
cvsId
public static final java.lang.String cvsId
SHA1
public SHA1()
init
public void init()
- SHA1Init - Initialize new context
- Overrides:
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.
- Overrides:
update in class MessageDigest
finish
public void finish()
- Complete processing on the message digest.
- Overrides:
finish in class MessageDigest
getAlg
public java.lang.String getAlg()
- Return a string that identifies this algorithm
- Overrides:
getAlg in class MessageDigest
digout
public java.lang.String digout()
- Print out the digest in a form that can be easily compared
to the test vectors.
main
public static void main(java.lang.String[] args)
- 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.
The reference to MoreOutputStream can be deleted. This is a
small class that opens a window to display the results. This
works around Symantec Cafe's tendency to shut down the DOS
window after showing the output, and the inability to scroll
back in a DOS window.