"

2013 FRC Java API

"

com.sun.squawk.security.ecc
Class FFA

java.lang.Object
  extended by com.sun.squawk.security.ecc.FFA

public final class FFA
extends Object

Simple and fast big-integer implementation suited for public key cryptography. API: Conventions (for all functions but 'mul' and 'sqr'): The functions require that their arguments have the same length. The arguments are given in the following sequence: r ... result a ... operand a b ... operand b The same int-array that is used for one or more of the operands can be used to store the result at the same time. Exceptions: - For 'mul' and 'sqr', the result must have twice the size of the operands. Therefore it is not possible to store the result to the same array that is used for either of the operands. - 'copy' and 'cmp' can handle arrays of different sizes. In addition, this class provides methods to acquire varibles of a specific size. To reduce creation of new objects, it is possible to release the variables after use, so that they can be recycled (re-acquired). Implementation details: Big integers are represented by int-arrays in little endian word order, using only 28 bits per word. Example: a[0] ... bits 27 ~ 0 a[1] ... bits 55 ~ 28 etc. Bits 31 ~ 28 in each integer are 0.


Field Summary
static int BITS_PER_WORD
           
static int BMASK
           
 
Constructor Summary
FFA(int bitLength)
           
 
Method Summary
 int[] acquireDoubleVar()
           
 int[] acquireVar()
           
 int[] acquireVar(int bits)
           
 int add(int[] r, int[] a, int[] b)
           
 int[] adjustLength(int[] a)
           
 int bitLength(int[] a)
           
 int cmp(int[] a, int[] b)
           
 void copy(int[] r, int[] a)
           
 int[] from(byte[] a, int ofs, int len)
           
 int[] from(int[] a)
           
 int[] from(int[] r, byte[] a, int ofs, int len)
           
 int[] from(int[] r, int[] a)
           
 int[] from(int[] r, String a)
           
 int[] from(String a)
           
 int getBitSize()
           
 int getByteSize()
           
 int getIntSize()
           
 boolean is(int[] a, int val)
           
 boolean isEven(int[] a)
           
 boolean isOdd(int[] a)
           
 void mod(int[] a, int[] b)
           
 void mul(int[] r, int[] a, int[] b)
           
 void releaseVar(int[] var)
           
 void set(int[] r, int val)
           
 int shl(int[] r, int[] a, int n)
           
 int shr(int[] r, int[] a, int n)
           
 void sqr(int[] r, int[] a)
           
 int sub(int[] r, int[] a, int[] b)
           
 boolean testBit(int[] a, int bit)
           
 void toByteArray(byte[] dst, int ofs, int len, int[] a)
           
 String toString(int[] a)
           
 void xor(int[] r, int[] a, int[] b)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BITS_PER_WORD

public static final int BITS_PER_WORD
See Also:
Constant Field Values

BMASK

public static final int BMASK
See Also:
Constant Field Values
Constructor Detail

FFA

public FFA(int bitLength)
Method Detail

acquireVar

public int[] acquireVar(int bits)

acquireVar

public int[] acquireVar()

acquireDoubleVar

public int[] acquireDoubleVar()

releaseVar

public void releaseVar(int[] var)

getBitSize

public int getBitSize()

getByteSize

public int getByteSize()

getIntSize

public int getIntSize()

toString

public String toString(int[] a)

from

public int[] from(int[] r,
                  String a)

from

public int[] from(String a)

from

public int[] from(int[] r,
                  int[] a)

from

public int[] from(int[] a)

from

public int[] from(int[] r,
                  byte[] a,
                  int ofs,
                  int len)

from

public int[] from(byte[] a,
                  int ofs,
                  int len)

toByteArray

public void toByteArray(byte[] dst,
                        int ofs,
                        int len,
                        int[] a)

add

public int add(int[] r,
               int[] a,
               int[] b)

sub

public int sub(int[] r,
               int[] a,
               int[] b)

mul

public void mul(int[] r,
                int[] a,
                int[] b)

sqr

public void sqr(int[] r,
                int[] a)

shl

public int shl(int[] r,
               int[] a,
               int n)

shr

public int shr(int[] r,
               int[] a,
               int n)

xor

public void xor(int[] r,
                int[] a,
                int[] b)

copy

public void copy(int[] r,
                 int[] a)

adjustLength

public int[] adjustLength(int[] a)

cmp

public int cmp(int[] a,
               int[] b)

bitLength

public int bitLength(int[] a)

testBit

public boolean testBit(int[] a,
                       int bit)

isEven

public boolean isEven(int[] a)

isOdd

public boolean isOdd(int[] a)

is

public boolean is(int[] a,
                  int val)

set

public void set(int[] r,
                int val)

mod

public void mod(int[] a,
                int[] b)

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"