Top Description Inners Fields Constructors Methods
org.bouncycastle.crypto.macs

public final Class Zuc256Mac

extends Object
implements Mac
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.Mac
Imports
org.bouncycastle.crypto.CipherParameters, .Mac, org.bouncycastle.crypto.engines.Zuc256CoreEngine

Zuc256 Mac implementation. Based on https://www.is.cas.cn/ztzl2016/zouchongzhi/201801/W020180126529970733243.pdf

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private int
theByteIndex

The current byte index.

private final Zuc256Mac.InternalZuc256Engine
theEngine

The Zuc256 Engine.

private final int[]
theKeyStream

The active keyStream.

private final int[]
theMac

The calculated Mac in words.

private final int
theMacLength

The mac length.

private Zuc256CoreEngine
theState

The initialised state.

private int
theWordIndex

The current word index.

private static final int
TOPBIT

The Maximum Bit Mask.

Constructor Summary

AccessConstructor and Description
public
Zuc256Mac(final int
the bit length of the Mac
pLength
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the size of the mac
doFinal
(final byte[]
the output buffer
out
,
final int
the starting offset in the output buffer
outOff
)

Implements org.bouncycastle.crypto.Mac.doFinal.

Finalize the mac.

public String

Returns:

the name
getAlgorithmName
()

Implements org.bouncycastle.crypto.Mac.getAlgorithmName.

Obtain Algorithm Name.

private int

Returns:

the word
getKeyStreamWord
(final int
the wordNumber
wordNo
,
final int
the bitNumber
bitNo
)

Obtain the keyStreamWord.

public int

Returns:

the size in Bytes
getMacSize
()

Implements org.bouncycastle.crypto.Mac.getMacSize.

Obtain Mac Size.

public void
init(final CipherParameters
the parameters
pParams
)

Implements org.bouncycastle.crypto.Mac.init.

Initialise the Mac.

private void
initKeyStream()

Initialise the keyStream.

public void
reset()

Implements org.bouncycastle.crypto.Mac.reset.

Reset the Mac.

private void
shift4Final()

Shift for final update.

private void
shift4NextByte()

Shift for next byte.

public void
update(final byte
the byte to update with
in
)

Implements org.bouncycastle.crypto.Mac.update.

Update the mac with a single byte.

public void
update(final byte[]
the input buffer
in
,
final int
the starting offset in the input buffer
inOff
,
final int
the length of data to process
len
)

Implements org.bouncycastle.crypto.Mac.update.

Update the mac.

private void
updateMac(final int
the bit number
bitNo
)

Update the Mac.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

theByteIndexback to summary
private int theByteIndex

The current byte index.

theEngineback to summary
private final Zuc256Mac.InternalZuc256Engine theEngine

The Zuc256 Engine.

theKeyStreamback to summary
private final int[] theKeyStream

The active keyStream.

theMacback to summary
private final int[] theMac

The calculated Mac in words.

theMacLengthback to summary
private final int theMacLength

The mac length.

theStateback to summary
private Zuc256CoreEngine theState

The initialised state.

theWordIndexback to summary
private int theWordIndex

The current word index.

TOPBITback to summary
private static final int TOPBIT

The Maximum Bit Mask.

Constructor Detail

Zuc256Macback to summary
public Zuc256Mac(final int pLength)

Constructor.

Parameters
pLength:int

the bit length of the Mac

Method Detail

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

Implements org.bouncycastle.crypto.Mac.doFinal.

Finalize the mac.

Parameters
out:byte[]

the output buffer

outOff:int

the starting offset in the output buffer

Returns:int

the size of the mac

getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.Mac.getAlgorithmName.

Obtain Algorithm Name.

Returns:String

the name

getKeyStreamWordback to summary
private int getKeyStreamWord(final int wordNo, final int bitNo)

Obtain the keyStreamWord.

Parameters
wordNo:int

the wordNumber

bitNo:int

the bitNumber

Returns:int

the word

getMacSizeback to summary
public int getMacSize()

Implements org.bouncycastle.crypto.Mac.getMacSize.

Obtain Mac Size.

Returns:int

the size in Bytes

initback to summary
public void init(final CipherParameters pParams)

Implements org.bouncycastle.crypto.Mac.init.

Initialise the Mac.

Parameters
pParams:CipherParameters

the parameters

initKeyStreamback to summary
private void initKeyStream()

Initialise the keyStream.

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.Mac.reset.

Reset the Mac.

shift4Finalback to summary
private void shift4Final()

Shift for final update.

shift4NextByteback to summary
private void shift4NextByte()

Shift for next byte.

updateback to summary
public void update(final byte in)

Implements org.bouncycastle.crypto.Mac.update.

Update the mac with a single byte.

Parameters
in:byte

the byte to update with

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

Implements org.bouncycastle.crypto.Mac.update.

Update the mac.

Parameters
in:byte[]

the input buffer

inOff:int

the starting offset in the input buffer

len:int

the length of data to process

updateMacback to summary
private void updateMac(final int bitNo)

Update the Mac.

Parameters
bitNo:int

the bit number

org.bouncycastle.crypto.macs back to summary

private Class Zuc256Mac.InternalZuc256Engine

extends Zuc256CoreEngine
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
InternalZuc256Engine(int pLength)

Method Summary

Modifier and TypeMethod and Description
pack-priv int
Inherited from org.bouncycastle.crypto.engines.Zuc256CoreEngine:
copygetAlgorithmNamegetMaxIterationsresetsetKeyAndIV

Constructor Detail

InternalZuc256Engineback to summary
public InternalZuc256Engine(int pLength)

Method Detail

createKeyStreamWordback to summary
pack-priv int createKeyStreamWord()