|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.server.kerberos.shared.crypto.encryption.NFold
public class NFold
An implementation of the n-fold algorithm, as required by RFC 3961, "Encryption and Checksum Specifications for Kerberos 5." "To n-fold a number X, replicate the input value to a length that is the least common multiple of n and the length of X. Before each repetition, the input is rotated to the right by 13 bit positions. The successive n-bit chunks are added together using 1's-complement addition (that is, with end-around carry) to yield a n-bit result."
Constructor Summary | |
---|---|
NFold()
|
Method Summary | |
---|---|
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. |
protected static byte[] |
sum(byte[] n1,
byte[] n2,
int len)
Perform one's complement addition (addition with end-around carry). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NFold()
Method Detail |
---|
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.
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |