Package org.bouncycastle.crypto.engines
Class Zuc128CoreEngine
- java.lang.Object
 - 
- org.bouncycastle.crypto.engines.Zuc128CoreEngine
 
 
- 
- All Implemented Interfaces:
 StreamCipher,Memoable
- Direct Known Subclasses:
 Zuc128Engine,Zuc256CoreEngine
public class Zuc128CoreEngine extends java.lang.Object implements StreamCipher, Memoable
Zuc128Engine implementation. Based on https://www.gsma.com/aboutus/wp-content/uploads/2014/12/eea3eia3zucv16.pdf 
- 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedZuc128CoreEngine()Constructor.protectedZuc128CoreEngine(Zuc128CoreEngine pSource)Constructor. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Memoablecopy()Create a copy of the engine.static voidencode32be(int val, byte[] buf, int off)Encode a 32-bit value into a buffer (little-endian).java.lang.StringgetAlgorithmName()Obtain Algorithm Name.protected intgetMaxIterations()Obtain Max iterations.voidinit(boolean forEncryption, CipherParameters params)initialise a Snow3G cipher.protected intmakeKeyStreamWord()Create the next keyStream word.intprocessBytes(byte[] in, int inOff, int len, byte[] out, int outOff)Process bytes.voidreset()Reset the engine.voidreset(Memoable pState)Reset from saved engine state.bytereturnByte(byte in)Process single byte.protected voidsetKeyAndIV(int[] pLFSR, byte[] k, byte[] iv)Process key and IV into LFSR. 
 - 
 
- 
- 
Constructor Detail
- 
Zuc128CoreEngine
protected Zuc128CoreEngine()
Constructor. 
- 
Zuc128CoreEngine
protected Zuc128CoreEngine(Zuc128CoreEngine pSource)
Constructor.- Parameters:
 pSource- the source engine
 
 - 
 
- 
Method Detail
- 
init
public void init(boolean forEncryption, CipherParameters params)initialise a Snow3G cipher.- Specified by:
 initin interfaceStreamCipher- Parameters:
 forEncryption- whether or not we are for encryption.params- the parameters required to set up the cipher.- Throws:
 java.lang.IllegalArgumentException- if the params argument is inappropriate.
 
- 
getMaxIterations
protected int getMaxIterations()
Obtain Max iterations.- Returns:
 - the maximum iterations
 
 
- 
getAlgorithmName
public java.lang.String getAlgorithmName()
Obtain Algorithm Name.- Specified by:
 getAlgorithmNamein interfaceStreamCipher- Returns:
 - the name
 
 
- 
processBytes
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)Process bytes.- Specified by:
 processBytesin interfaceStreamCipher- Parameters:
 in- the input bufferinOff- the starting offset in the input bufferlen- the length of data in the input bufferout- the output bufferoutOff- the starting offset in the output buffer- Returns:
 - the number of bytes returned in the output buffer
 
 
- 
reset
public void reset()
Reset the engine.- Specified by:
 resetin interfaceStreamCipher
 
- 
returnByte
public byte returnByte(byte in)
Process single byte.- Specified by:
 returnBytein interfaceStreamCipher- Parameters:
 in- the input byte- Returns:
 - the output byte
 
 
- 
encode32be
public static void encode32be(int val, byte[] buf, int off)Encode a 32-bit value into a buffer (little-endian).- Parameters:
 val- the value to encodebuf- the output bufferoff- the output offset
 
- 
setKeyAndIV
protected void setKeyAndIV(int[] pLFSR, byte[] k, byte[] iv)Process key and IV into LFSR.- Parameters:
 pLFSR- the LFSRk- the keyiv- the iv
 
- 
makeKeyStreamWord
protected int makeKeyStreamWord()
Create the next keyStream word.- Returns:
 - the next word
 
 
- 
copy
public Memoable copy()
Create a copy of the engine. 
 - 
 
 -