All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.math.BigInteger

java.lang.Object
   |
   +----cryptix.math.BigNum
           |
           +----cryptix.math.BigInteger

public class BigInteger
extends BigNum
A class implementing arbitrary-length integers. java.math.BigInteger is preferred for new code.

Copyright © 1995-1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.3 $

Author:
unattributed

Variable Index

 o one
 o zero

Constructor Index

 o BigInteger()
 o BigInteger(BigInteger)
 o BigInteger(byte[])
 o BigInteger(int)
 o BigInteger(String)

Method Index

 o add(BigInteger, BigInteger)
 o add(int)
 o assign(BigInteger)
 o assign(int)
 o bitLength()
 o clone()
 o cmp(BigInteger)
 o copy(Object)
 o dec()
 o div(BigInteger, BigInteger)
 o equals(Object)
Tests whether another object is equal to this one.
 o finalize()
 o fromByteArray(byte[])
 o fromJavaMathBigInteger(BigInteger)
Convert from a java.math.BigInteger to a cryptix.math.BigInteger.
 o fromString(String)
 o gcd(BigNum, BigNum)
 o inc()
 o inverseModN(BigInteger, BigInteger)
 o main(String[])
 o mod(BigInteger, BigInteger)
 o modExp(BigInteger, BigInteger)
 o mul(BigInteger, BigInteger)
 o newBuffer(int)
An internal function to create a buffer big enough in which to store a number.
 o self_test(PrintWriter)
 o shiftLeft(int)
 o shiftRight(int)
 o sub(BigInteger, BigInteger)
 o toByteArray()
Convert a number into a byte array.
 o toJavaMathBigInteger()
Convert this cryptix.math.BigInteger to a java.math.BigInteger.
 o toString()
 o zero()

Variables

 o zero
 public static final BigInteger zero
 o one
 public static final BigInteger one

Constructors

 o BigInteger
 public BigInteger()
 o BigInteger
 public BigInteger(int from)
 o BigInteger
 public BigInteger(BigInteger from)
 o BigInteger
 public BigInteger(String hexString)
 o BigInteger
 public BigInteger(byte buffer[])

Methods

 o bitLength
 public int bitLength()
 o clone
 public Object clone()
Overrides:
clone in class BigNum
 o copy
 public void copy(Object src)
Overrides:
copy in class BigNum
 o assign
 public BigInteger assign(BigInteger n)
 o assign
 public BigInteger assign(int n)
 o fromString
 public void fromString(String inHex)
 o toString
 public String toString()
Overrides:
toString in class Object
 o finalize
 protected void finalize()
Overrides:
finalize in class BigNum
 o modExp
 public BigInteger modExp(BigInteger power,
                          BigInteger modulo)
 o inverseModN
 public BigInteger inverseModN(BigInteger a,
                               BigInteger n)
 o mod
 public BigInteger mod(BigInteger a,
                       BigInteger b)
 o mul
 public BigInteger mul(BigInteger a,
                       BigInteger b)
 o div
 public BigInteger div(BigInteger a,
                       BigInteger b)
 o add
 public BigInteger add(BigInteger a,
                       BigInteger b)
 o add
 public BigInteger add(int a)
 o sub
 public BigInteger sub(BigInteger a,
                       BigInteger b)
 o gcd
 public BigInteger gcd(BigNum a,
                       BigNum b)
 o cmp
 public int cmp(BigInteger a)
 o equals
 public boolean equals(Object o)
Tests whether another object is equal to this one.

Note: since BigIntegers are mutable, it was a mistake to override equals. Also, equals and hashCode should always be overridden together.

Parameters:
obj - object to test
Returns:
true if the object is equal, otherwise false.
Overrides:
equals in class Object
 o inc
 public BigInteger inc()
 o dec
 public BigInteger dec()
 o shiftLeft
 public BigInteger shiftLeft(int n)
 o shiftRight
 public BigInteger shiftRight(int n)
 o zero
 public static BigInteger zero()
 o newBuffer
 protected static byte[] newBuffer(int bitLen)
An internal function to create a buffer big enough in which to store a number.

Parameters:
bitLen - The number of bits in the number.
Returns:
a buffer in which to store a number.
 o toByteArray
 public byte[] toByteArray()
Convert a number into a byte array.

Returns:
a byte array.
 o fromByteArray
 public void fromByteArray(byte buf[])
 o toJavaMathBigInteger
 public BigInteger toJavaMathBigInteger()
Convert this cryptix.math.BigInteger to a java.math.BigInteger.

Returns:
the java.math.BigInteger
 o fromJavaMathBigInteger
 public static BigInteger fromJavaMathBigInteger(BigInteger from)
Convert from a java.math.BigInteger to a cryptix.math.BigInteger.

Parameters:
from - the java.math.BigInteger
Returns:
the cryptix.math.BigInteger
 o main
 public static void main(String args[])
 o self_test
 public static void self_test(PrintWriter out) throws Exception

All Packages  Class Hierarchy  This Package  Previous  Next  Index