public class PCFBMode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected BlockCipher |
c
The underlying block cipher.
|
protected byte[] |
feedback_register
The register, with which data is XOR'ed
|
protected int |
registerPointer
When this reaches the end of the register, we refillBuffer() i.e.
|
Modifier | Constructor and Description |
---|---|
protected |
PCFBMode(BlockCipher c) |
protected |
PCFBMode(BlockCipher c,
byte[] iv,
int offset) |
Modifier and Type | Method and Description |
---|---|
void |
blockDecipher(byte[] buf,
int off,
int len) |
void |
blockEncipher(byte[] buf,
int off,
int len) |
static PCFBMode |
create(BlockCipher c)
Deprecated.
|
static PCFBMode |
create(BlockCipher c,
byte[] iv) |
static PCFBMode |
create(BlockCipher c,
byte[] iv,
int offset)
Create the PCFB with an IV.
|
int |
decipher(int b)
Deciphers one byte of data, by XOR'ing the ciphertext byte with
one byte from the encrypted buffer.
|
int |
encipher(int b)
Enciphers one byte of data, by XOR'ing the plaintext byte with
one byte from the encrypted buffer.
|
int |
lengthIV()
returns the length of the IV
|
static int |
lengthIV(BlockCipher c)
returns the length of the IV for a PCFB created with a specific cipher.
|
void |
readIV(java.io.InputStream in)
Reads the initialization vector from the given stream.
|
protected void |
refillBuffer() |
void |
reset(byte[] iv)
Resets the PCFBMode to an initial IV
|
void |
reset(byte[] iv,
int offset)
Resets the PCFBMode to an initial IV
|
void |
writeIV(RandomSource rs,
java.io.OutputStream out)
Writes the initialization vector to the stream.
|
protected final BlockCipher c
protected final byte[] feedback_register
protected int registerPointer
protected PCFBMode(BlockCipher c)
protected PCFBMode(BlockCipher c, byte[] iv, int offset)
@Deprecated public static PCFBMode create(BlockCipher c)
c
- The underlying block cipherpublic static PCFBMode create(BlockCipher c, byte[] iv)
public static PCFBMode create(BlockCipher c, byte[] iv, int offset)
offset
- public final void reset(byte[] iv)
public final void reset(byte[] iv, int offset)
iv
- The buffer containing the IV.offset
- The offset to start reading the IV at.public void writeIV(RandomSource rs, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void readIV(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public int lengthIV()
public static int lengthIV(BlockCipher c)
public int decipher(int b)
public void blockDecipher(byte[] buf, int off, int len)
public int encipher(int b)
public void blockEncipher(byte[] buf, int off, int len)
protected void refillBuffer()