Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.security.hash
Class Sha512  view Sha512 download Sha512.java

java.lang.Object
  extended bygnu.java.security.hash.BaseHash
      extended bygnu.java.security.hash.Sha512
All Implemented Interfaces:
java.lang.Cloneable, IMessageDigest

public class Sha512
extends BaseHash

Implementation of SHA2-3 [SHA-512] per the IETF Draft Specification.

References:

  1. Descriptions of SHA-256, SHA-384, and SHA-512,
  2. http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf


Field Summary
private static int BLOCK_SIZE
           
private static java.lang.String DIGEST0
           
private  long h0
          512-bit interim result.
private  long h1
          512-bit interim result.
private  long h2
          512-bit interim result.
private  long h3
          512-bit interim result.
private  long h4
          512-bit interim result.
private  long h5
          512-bit interim result.
private  long h6
          512-bit interim result.
private  long h7
          512-bit interim result.
private static long[] k
           
private static java.lang.Boolean valid
          caches the result of the correctness test, once executed.
private static long[] w
           
 
Fields inherited from class gnu.java.security.hash.BaseHash
blockSize, buffer, count, hashSize, name
 
Constructor Summary
  Sha512()
          Trivial 0-arguments constructor.
private Sha512(Sha512 md)
          Private constructor for cloning purposes.
 
Method Summary
 java.lang.Object clone()
          Returns a clone copy of this instance.
static long[] G(long hh0, long hh1, long hh2, long hh3, long hh4, long hh5, long hh6, long hh7, byte[] in, int offset)
           
protected  byte[] getResult()
          Constructs the result from the contents of the current context.
protected  byte[] padBuffer()
          Returns the byte array to use as padding before completing a hash operation.
protected  void resetContext()
          Resets the instance for future re-use.
 boolean selfTest()
          A basic test.
private static long[] sha(long hh0, long hh1, long hh2, long hh3, long hh4, long hh5, long hh6, long hh7, byte[] in, int offset)
           
protected  void transform(byte[] in, int offset)
          The block digest transformation per se.
 
Methods inherited from class gnu.java.security.hash.BaseHash
blockSize, digest, hashSize, name, reset, update, update, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

k

private static final long[] k

BLOCK_SIZE

private static final int BLOCK_SIZE
See Also:
Constant Field Values

DIGEST0

private static final java.lang.String DIGEST0
See Also:
Constant Field Values

w

private static final long[] w

valid

private static java.lang.Boolean valid
caches the result of the correctness test, once executed.


h0

private long h0
512-bit interim result.


h1

private long h1
512-bit interim result.


h2

private long h2
512-bit interim result.


h3

private long h3
512-bit interim result.


h4

private long h4
512-bit interim result.


h5

private long h5
512-bit interim result.


h6

private long h6
512-bit interim result.


h7

private long h7
512-bit interim result.

Constructor Detail

Sha512

public Sha512()
Trivial 0-arguments constructor.


Sha512

private Sha512(Sha512 md)

Private constructor for cloning purposes.

Method Detail

G

public static final long[] G(long hh0,
                             long hh1,
                             long hh2,
                             long hh3,
                             long hh4,
                             long hh5,
                             long hh6,
                             long hh7,
                             byte[] in,
                             int offset)

clone

public java.lang.Object clone()
Description copied from interface: IMessageDigest

Returns a clone copy of this instance.

Specified by:
clone in interface IMessageDigest
Specified by:
clone in class BaseHash

transform

protected void transform(byte[] in,
                         int offset)
Description copied from class: BaseHash

The block digest transformation per se.

Specified by:
transform in class BaseHash

padBuffer

protected byte[] padBuffer()
Description copied from class: BaseHash

Returns the byte array to use as padding before completing a hash operation.

Specified by:
padBuffer in class BaseHash

getResult

protected byte[] getResult()
Description copied from class: BaseHash

Constructs the result from the contents of the current context.

Specified by:
getResult in class BaseHash

resetContext

protected void resetContext()
Description copied from class: BaseHash
Resets the instance for future re-use.

Specified by:
resetContext in class BaseHash

selfTest

public boolean selfTest()
Description copied from interface: IMessageDigest

A basic test. Ensures that the digest of a pre-determined message is equal to a known pre-computed value.

Specified by:
selfTest in interface IMessageDigest
Specified by:
selfTest in class BaseHash

sha

private static final long[] sha(long hh0,
                                long hh1,
                                long hh2,
                                long hh3,
                                long hh4,
                                long hh5,
                                long hh6,
                                long hh7,
                                byte[] in,
                                int offset)