public class NFold
extends java.lang.Object
| Constructor and Description |
|---|
NFold() |
| Modifier and Type | Method and Description |
|---|---|
private static int |
getBit(byte[] data,
int pos)
Get a bit from a byte array at a given position.
|
protected static int |
getLcm(int n1,
int n2)
For 2 numbers, return the least-common multiple.
|
static byte[] |
nFold(int n,
byte[] data)
N-fold the data n times.
|
private static byte[] |
rotateRight(byte[] in,
int len,
int step)
Right-rotate the given byte array.
|
private static void |
setBit(byte[] data,
int pos,
int val)
Set a bit in a byte array at a given position.
|
protected static byte[] |
sum(byte[] n1,
byte[] n2,
int len)
Perform one's complement addition (addition with end-around carry).
|
public static byte[] nFold(int n,
byte[] data)
n - The number of times to n-fold the data.data - The data to n-fold.protected static int getLcm(int n1,
int n2)
n1 - The first number.n2 - The second number.private static byte[] rotateRight(byte[] in,
int len,
int step)
in - The byte array to right-rotate.len - The length of the byte array to rotate.step - The number of positions to rotate the byte array.protected static byte[] sum(byte[] n1,
byte[] n2,
int len)
n1 - The first number.n2 - The second number.len - The length of the byte arrays to sum.private static int getBit(byte[] data,
int pos)
data - The data to get the bit from.pos - The position to get the bit at.private static void setBit(byte[] data,
int pos,
int val)
data - The data to set the bit in.pos - The position of the bit to set.The - value to set the bit to.