Stellent
HowToComponents
JavaDoc

intradoc.conversion
Class Sha1

java.lang.Object
  |
  +--intradoc.conversion.MessageDigest
        |
        +--intradoc.conversion.Sha1

public final class Sha1
extends MessageDigest

Note: this code is based on the code supplied gotten from Chuck McManis created on 5 Oct 1996 from the URL http://professionals.com/~cmcmanis//java/ Based on the C code that Steve Reid wrote his header was : SHA-1 in C By Steve Reid 100% Public Domain Test Vectors (from FIPS PUB 180-1) "abc" A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 A million repetitions of "a" 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F 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
protected  int[] m_block
           
protected  int m_blockIndex
           
protected  long m_count
           
protected  int[] m_dd
          Working variables.
protected  int[] m_state
           
 
Fields inherited from class intradoc.conversion.MessageDigest
m_digestBits, m_digestValid
 
Constructor Summary
Sha1()
           
 
Method Summary
protected  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()
          Initialize new context
 void update(byte b)
          Add one byte to the digest.
 
Methods inherited from class intradoc.conversion.MessageDigest
computeDigest, isEqual, isEqual, toString, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_state

protected int[] m_state

m_count

protected long m_count

m_block

protected int[] m_block

m_blockIndex

protected int m_blockIndex

m_dd

protected int[] m_dd
Working variables.

Constructor Detail

Sha1

public Sha1()
Method Detail

init

public void init()
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

digout

protected java.lang.String digout()
Print out the digest in a form that can be easily compared to the test vectors.



(c) 1996-2005  All rights reserved.  Stellent, Inc.