Top Description Fields Constructors Methods
org.bouncycastle.crypto.digests

public Class SkeinDigest

extends Object
implements ExtendedDigest, Memoable
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.Memoable, org.bouncycastle.crypto.ExtendedDigest, org.bouncycastle.crypto.Digest
Imports
org.bouncycastle.crypto.CryptoServicePurpose, .CryptoServicesRegistrar, .ExtendedDigest, org.bouncycastle.crypto.engines.ThreefishEngine, org.bouncycastle.crypto.params.SkeinParameters, org.bouncycastle.util.Memoable

Implementation of the Skein parameterised hash function in 256, 512 and 1024 bit block sizes, based on the Threefish tweakable block cipher.

This is the 1.3 version of Skein defined in the Skein hash function submission to the NIST SHA-3 competition in October 2010.

Skein was designed by Niels Ferguson - Stefan Lucks - Bruce Schneier - Doug Whiting - Mihir Bellare - Tadayoshi Kohno - Jon Callas - Jesse Walker.

See Also
SkeinEngine, SkeinParameters

Field Summary

Modifier and TypeField and Description
private SkeinEngine
private final CryptoServicePurpose
public static final int
SKEIN_1024

1024 bit block size - Skein-1024

public static final int
SKEIN_256

256 bit block size - Skein-256

public static final int
SKEIN_512

512 bit block size - Skein-512

Constructor Summary

AccessConstructor and Description
public
SkeinDigest(int
the internal state size in bits - one of SKEIN_256, SKEIN_512 or SKEIN_1024.
stateSizeBits
,
int
the output/digest size to produce in bits, which must be an integral number of bytes.
digestSizeBits
)

Constructs a Skein digest with an internal state size and output size.

public
SkeinDigest(int stateSizeBits, int digestSizeBits, CryptoServicePurpose purpose)

public

Method Summary

Modifier and TypeMethod and Description
public Memoable
copy()

Implements org.bouncycastle.util.Memoable.copy.

Produce a copy of this object with its configuration and in its current state.

public int
doFinal(byte[]
the array the digest is to be copied into.
out
,
int
the offset into the out array the digest is to start at.
outOff
)

Implements org.bouncycastle.crypto.Digest.doFinal.

close the digest, producing the final digest value.

public String
public int
getByteLength()

Implements org.bouncycastle.crypto.ExtendedDigest.getByteLength.

Return the size in bytes of the internal buffer the digest applies it's compression function to.

public int
getDigestSize()

Implements org.bouncycastle.crypto.Digest.getDigestSize.

return the size, in bytes, of the digest produced by this message digest.

public void
init(SkeinParameters
the parameters to apply to this engine, or null to use no parameters.
params
)

Optionally initialises the Skein digest with the provided parameters.

public void
reset(Memoable
an object originally copied from an object of the same type as this instance.
other
)

Implements org.bouncycastle.util.Memoable.reset.

Restore a copied object state into this object.

public void
reset()

Implements org.bouncycastle.crypto.Digest.reset.

reset the digest back to it's initial state.

public void
update(byte
the input byte to be entered.
in
)

Implements org.bouncycastle.crypto.Digest.update.

update the message digest with a single byte.

public void
update(byte[]
the byte array containing the data.
in
,
int
the offset into the byte array where the data starts.
inOff
,
int
the length of the data.
len
)

Implements org.bouncycastle.crypto.Digest.update.

update the message digest with a block of bytes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

engineback to summary
private SkeinEngine engine
purposeback to summary
private final CryptoServicePurpose purpose
SKEIN_1024back to summary
public static final int SKEIN_1024

1024 bit block size - Skein-1024

SKEIN_256back to summary
public static final int SKEIN_256

256 bit block size - Skein-256

SKEIN_512back to summary
public static final int SKEIN_512

512 bit block size - Skein-512

Constructor Detail

SkeinDigestback to summary
public SkeinDigest(int stateSizeBits, int digestSizeBits)

Constructs a Skein digest with an internal state size and output size.

Parameters
stateSizeBits:int

the internal state size in bits - one of SKEIN_256, SKEIN_512 or SKEIN_1024.

digestSizeBits:int

the output/digest size to produce in bits, which must be an integral number of bytes.

SkeinDigestback to summary
public SkeinDigest(int stateSizeBits, int digestSizeBits, CryptoServicePurpose purpose)
SkeinDigestback to summary
public SkeinDigest(SkeinDigest digest)

Method Detail

copyback to summary
public Memoable copy()

Implements org.bouncycastle.util.Memoable.copy.

Doc from org.bouncycastle.util.Memoable.copy.

Produce a copy of this object with its configuration and in its current state.

The returned object may be used simply to store the state, or may be used as a similar object starting from the copied state.

doFinalback to summary
public int doFinal(byte[] out, int outOff)

Implements org.bouncycastle.crypto.Digest.doFinal.

Doc from org.bouncycastle.crypto.Digest.doFinal.

close the digest, producing the final digest value. The doFinal call leaves the digest reset.

Parameters
out:byte[]

the array the digest is to be copied into.

outOff:int

the offset into the out array the digest is to start at.

getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.Digest.getAlgorithmName.

Doc from org.bouncycastle.crypto.Digest.getAlgorithmName.

return the algorithm name

Returns:String

the algorithm name

getByteLengthback to summary
public int getByteLength()

Implements org.bouncycastle.crypto.ExtendedDigest.getByteLength.

Doc from org.bouncycastle.crypto.ExtendedDigest.getByteLength.

Return the size in bytes of the internal buffer the digest applies it's compression function to.

Returns:int

byte length of the digests internal buffer.

getDigestSizeback to summary
public int getDigestSize()

Implements org.bouncycastle.crypto.Digest.getDigestSize.

Doc from org.bouncycastle.crypto.Digest.getDigestSize.

return the size, in bytes, of the digest produced by this message digest.

Returns:int

the size, in bytes, of the digest produced by this message digest.

initback to summary
public void init(SkeinParameters params)

Optionally initialises the Skein digest with the provided parameters.
See SkeinParameters for details on the parameterisation of the Skein hash function.

Parameters
params:SkeinParameters

the parameters to apply to this engine, or null to use no parameters.

resetback to summary
public void reset(Memoable other)

Implements org.bouncycastle.util.Memoable.reset.

Doc from org.bouncycastle.util.Memoable.reset.

Restore a copied object state into this object.

Implementations of this method should try to avoid or minimise memory allocation to perform the reset.

Parameters
other:Memoable

an object originally copied from an object of the same type as this instance.

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.Digest.reset.

Doc from org.bouncycastle.crypto.Digest.reset.

reset the digest back to it's initial state.

updateback to summary
public void update(byte in)

Implements org.bouncycastle.crypto.Digest.update.

Doc from org.bouncycastle.crypto.Digest.update.

update the message digest with a single byte.

Parameters
in:byte

the input byte to be entered.

updateback to summary
public void update(byte[] in, int inOff, int len)

Implements org.bouncycastle.crypto.Digest.update.

Doc from org.bouncycastle.crypto.Digest.update.

update the message digest with a block of bytes.

Parameters
in:byte[]

the byte array containing the data.

inOff:int

the offset into the byte array where the data starts.

len:int

the length of the data.