org.bouncycastle.crypto.engines

Class HC256Engine

Implemented Interfaces:
StreamCipher

public class HC256Engine
extends java.lang.Object
implements StreamCipher

HC-256 is a software-efficient stream cipher created by Hongjun Wu. It generates keystream from a 256-bit secret key and a 256-bit initialization vector.

http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc256_p3.pdf

Its brother, HC-128, is a third phase candidate in the eStream contest. The algorithm is patent-free. No attacks are known as of today (April 2007). See http://www.ecrypt.eu.org/stream/hcp3.html

Method Summary

String
getAlgorithmName()
void
init(boolean forEncryption, CipherParameters params)
Initialise a HC-256 cipher.
void
processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)
void
reset()
byte
returnByte(byte in)

Method Details

getAlgorithmName

public String getAlgorithmName()
Specified by:
getAlgorithmName in interface StreamCipher

init

public void init(boolean forEncryption,
                 CipherParameters params)
            throws IllegalArgumentException
Initialise a HC-256 cipher.
Specified by:
init in interface StreamCipher
Parameters:
forEncryption - whether or not we are for encryption. Irrelevant, as encryption and decryption are the same.
params - the parameters required to set up the cipher.

processBytes

public void processBytes(byte[] in,
                         int inOff,
                         int len,
                         byte[] out,
                         int outOff)
            throws DataLengthException
Specified by:
processBytes in interface StreamCipher

reset

public void reset()
Specified by:
reset in interface StreamCipher

returnByte

public byte returnByte(byte in)
Specified by:
returnByte in interface StreamCipher