java.lang.Object
org.bouncycastle.crypto.digests.LongDigest
org.bouncycastle.crypto.digests.SHA512Digest
- All Implemented Interfaces:
Digest, EncodableDigest, ExtendedDigest, Memoable
FIPS 180-2 implementation of SHA-512.
block word digest
SHA-1 512 32 160
SHA-256 512 32 256
SHA-384 1024 64 384
SHA-512 1024 64 512
Field Summary
FieldsFields inherited from class LongDigest
H1, H2, H3, H4, H5, H6, H7, H8, K, purposeModifier and TypeFieldDescriptionprotected longHash working variables H1-H8.protected longHash working variables H1-H8.protected longHash working variables H1-H8.protected longHash working variables H1-H8.protected longHash working variables H1-H8.protected longHash working variables H1-H8.protected longHash working variables H1-H8.protected longHash working variables H1-H8.(package private) static final long[]SHA-384 and SHA-512 constants (first 64 bits of fractional parts of cube roots of first 64 primes)protected final CryptoServicePurposeCrypto operation purpose.Constructor Summary
ConstructorsConstructorDescriptionStandard constructorSHA512Digest(byte[] encodedState) State constructor - create a digest initialised with the state of a previous one.SHA512Digest(CryptoServicePurpose purpose) Standard constructor, with purposeCopy constructor.Method Summary
Public MethodsModifier and TypeMethodDescriptioncopy()Produce a copy of this object with its configuration and in its current state.protected CryptoServicePropertiesReturns the properties for the crypto service.intdoFinal(byte[] out, int outOff) close the digest, producing the final digest value.return the algorithm nameintreturn the size, in bytes, of the digest produced by this message digest.byte[]Return an encoded byte array for the digest's internal statevoidreset()Reset the chaining variablesvoidRestore a copied object state into this object.Methods inherited from class LongDigest
copyIn, finish, getByteLength, getEncodedStateSize, populateState, processBlock, processLength, processWord, restoreState, update, updateModifier and TypeMethodDescriptionprotected voidcopyIn(LongDigest t) Takes over another digest's buffer and byte counts.voidfinish()Pads the message to a block boundary and compresses the final block.intGets the digest length in bytes, 128 for a SHA-512 family digest.protected intReturns the size of the encoded state.protected voidpopulateState(byte[] state) Writes this digest's buffer, counts and chaining values into a byte array.protected voidExpands and mixes the 80-word schedule, then updates the chaining values.protected voidprocessLength(long lowW, long hiW) Process the bit length data.protected voidprocessWord(byte[] in, int inOff) Process a word of input data.protected voidrestoreState(byte[] encodedState) Reads back a state previously written byLongDigest.populateState(byte[]).voidupdate(byte in) Updates the digest with one byte.voidupdate(byte[] in, int inOff, int len) Updates the digest with the given bytes.
Field Details
DIGEST_LENGTH
Constructor Details
SHA512Digest
public SHA512Digest()Standard constructorSHA512Digest
Standard constructor, with purpose- Parameters:
purpose- the CryptoServicePurpose to register this digest under.
SHA512Digest
Copy constructor. This will copy the state of the provided message digest.- Parameters:
t- the digest to copy the purpose and buffered state from.
SHA512Digest
public SHA512Digest(byte[] encodedState) State constructor - create a digest initialised with the state of a previous one.- Parameters:
encodedState- the encoded state from the originating digest.
Method Details
getAlgorithmName
getDigestSize
public int getDigestSize()Description copied from interface:Digestreturn the size, in bytes, of the digest produced by this message digest.- Returns:
- the size, in bytes, of the digest produced by this message digest.
doFinal
public int doFinal(byte[] out, int outOff) Description copied from interface:Digestclose the digest, producing the final digest value. The doFinal call leaves the digest reset.- Parameters:
out- the array the digest is to be copied into.outOff- the offset into the out array the digest is to start at.- Returns:
- the number of bytes written to out, equal to the digest size in bytes.
reset
public void reset()Reset the chaining variables- Specified by:
resetin interfaceDigest- Overrides:
resetin classLongDigest
copy
reset
getEncodedState
public byte[] getEncodedState()Description copied from interface:EncodableDigestReturn an encoded byte array for the digest's internal state- Returns:
- an encoding of the digests internal state.
cryptoServiceProperties
Description copied from class:LongDigestReturns the properties for the crypto service.- Specified by:
cryptoServicePropertiesin classLongDigest- Returns:
- the crypto service properties