Bouncy Castle Cryptography Library 1.77.0

org.bouncycastle.crypto.util
Class RadixConverter

java.lang.Object
  |
  +--org.bouncycastle.crypto.util.RadixConverter

public class RadixConverter
extends java.lang.Object

Utility class to convert decimal numbers (BigInteger) into a number in the base provided and the other way round.

For an application of this see the FPE parameter classes.


Constructor Summary
RadixConverter(int radix)
           
RadixConverter(int radix, int numberOfCachedPowers)
           
 
Method Summary
 java.math.BigInteger fromEncoding(short[] digits)
           
 int getDigitsGroupLength()
           
 int getRadix()
           
 void toEncoding(java.math.BigInteger number, int messageLength, short[] out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadixConverter

public RadixConverter(int radix,
                      int numberOfCachedPowers)
Parameters:
radix - the radix to use for base conversions
numberOfCachedPowers - number of intermediate base powers to precompute and cache.

RadixConverter

public RadixConverter(int radix)
Parameters:
radix - the radix to use for base conversions.
Method Detail

getRadix

public int getRadix()

toEncoding

public void toEncoding(java.math.BigInteger number,
                       int messageLength,
                       short[] out)

fromEncoding

public java.math.BigInteger fromEncoding(short[] digits)

getDigitsGroupLength

public int getDigitsGroupLength()

Bouncy Castle Cryptography Library 1.77.0