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

public Class GOST3411Digest

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.BlockCipher, .CryptoServiceProperties, .CryptoServicePurpose, .CryptoServicesRegistrar, .ExtendedDigest, org.bouncycastle.crypto.engines.GOST28147Engine, org.bouncycastle.crypto.params.KeyParameter, .ParametersWithSBox, org.bouncycastle.util.Arrays, .Memoable, .Pack

implementation of GOST R 34.11-94

Field Summary

Modifier and TypeField and Description
pack-priv byte[]
a

private long
private byte[][]
C

private static final byte[]
C2

reset the chaining variables to the IV values.

private BlockCipher
private static final int
private byte[]
H

private byte[]
K

private byte[]
L

private byte[]
M

private final CryptoServicePurpose
pack-priv byte[]
S

private byte[]
private byte[]
pack-priv byte[]
U

pack-priv byte[]
V

pack-priv byte[]
W

pack-priv short[]
pack-priv short[]
private byte[]
private int

Constructor Summary

AccessConstructor and Description
public
GOST3411Digest()

Standard constructor

public
public
GOST3411Digest(byte[] sBoxParam)

Constructor to allow use of a particular sbox with GOST28147

public
GOST3411Digest(byte[] sBoxParam, CryptoServicePurpose purpose)

Constructor to allow use of a particular sbox with GOST28147

public
GOST3411Digest(GOST3411Digest t)

Copy constructor.

Method Summary

Modifier and TypeMethod and Description
private byte[]
A(byte[] in)

public Memoable
copy()

Implements org.bouncycastle.util.Memoable.copy.

Produce a copy of this object with its configuration and in its current state.
private void
cpyBytesToShort(byte[] S, short[] wS)

private void
cpyShortToBytes(short[] wS, byte[] S)

protected CryptoServiceProperties
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.
private void
E(byte[] key, byte[] s, int sOff, byte[] in, int inOff)

private void
private void
fw(byte[] in)

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.
private byte[]
P(byte[] in)

protected void
processBlock(byte[] in, int inOff)

public void
reset()

Implements org.bouncycastle.crypto.Digest.reset.

reset the digest back to it's initial state.
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.
private void
sumByteArray(byte[] in)

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

aback to summary
pack-priv byte[] a
byteCountback to summary
private long byteCount
Cback to summary
private byte[][] C
C2back to summary
private static final byte[] C2

reset the chaining variables to the IV values.

cipherback to summary
private BlockCipher cipher
DIGEST_LENGTHback to summary
private static final int DIGEST_LENGTH
Hback to summary
private byte[] H
Kback to summary
private byte[] K
Lback to summary
private byte[] L
Mback to summary
private byte[] M
purposeback to summary
private final CryptoServicePurpose purpose
Sback to summary
pack-priv byte[] S
sBoxback to summary
private byte[] sBox
Sumback to summary
private byte[] Sum
Uback to summary
pack-priv byte[] U
Vback to summary
pack-priv byte[] V
Wback to summary
pack-priv byte[] W
w_Sback to summary
pack-priv short[] w_S
wSback to summary
pack-priv short[] wS
xBufback to summary
private byte[] xBuf
xBufOffback to summary
private int xBufOff

Constructor Detail

GOST3411Digestback to summary
public GOST3411Digest()

Standard constructor

GOST3411Digestback to summary
public GOST3411Digest(CryptoServicePurpose purpose)
GOST3411Digestback to summary
public GOST3411Digest(byte[] sBoxParam)

Constructor to allow use of a particular sbox with GOST28147

See Also
GOST28147Engine#getSBox(String)
GOST3411Digestback to summary
public GOST3411Digest(byte[] sBoxParam, CryptoServicePurpose purpose)

Constructor to allow use of a particular sbox with GOST28147

See Also
GOST28147Engine#getSBox(String)
GOST3411Digestback to summary
public GOST3411Digest(GOST3411Digest t)

Copy constructor. This will copy the state of the provided message digest.

Method Detail

Aback to summary
private byte[] A(byte[] in)
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.

cpyBytesToShortback to summary
private void cpyBytesToShort(byte[] S, short[] wS)
cpyShortToBytesback to summary
private void cpyShortToBytes(short[] wS, byte[] S)
cryptoServicePropertiesback to summary
protected CryptoServiceProperties cryptoServiceProperties()
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.

Eback to summary
private void E(byte[] key, byte[] s, int sOff, byte[] in, int inOff)
finishback to summary
private void finish()
fwback to summary
private void fw(byte[] in)
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.

Pback to summary
private byte[] P(byte[] in)
processBlockback to summary
protected void processBlock(byte[] in, int inOff)
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.

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.

sumByteArrayback to summary
private void sumByteArray(byte[] in)
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.