[Top] [Prev] [Next]

IPint adt - 'infinite' precision integer utility functions

include "keyring.m"
keyring:= load Keyring Keyring->PATH;
#infinite precision integers
IPint: adt
{
  x:    int;
  #conversions
  iptob64:   fn(i: self ref IPint): string;
  b64toip:   fn(str: string)  : ref IPint;
  iptobytes: fn(i: self ref IPint): array of byte;
  #large random integer generator
  random:    fn(minbits, maxbits: int): ref IPint;
  #operations
  bits:      fn(i:  self ref IPint): int;
  expmod:    fn(base: self ref IPint, exp, mod: 
                            ref IPint):ref IPint;
  eq:        fn(i1:  self ref IPint, i2: ref IPint): int;
};

Description

The IPint adt provides the following integer manipulation functions required for cryptographic support in Limbo:

iptob64(i)

The iptob64 function converts a large integer to a base 64 string for convenient transmission over a network connection.

b64toip(str)

The b64toip function performs the inverse operation of iptob64.

iptobytes(i)

The iptobytes function converts a large integer to an array of bytes for faster communication to the kernel ssl device.

random (minbits, maxbits)

The random function generates large random numbers with a range of minbits to maxbits. The maximum number allowed in the current implementation is 228192-1. The seed for the generator is obtained by dueling clocks. IPint types are manipulated during security protocols.

bits (i)

The bits function returns the number of bits of precision in IPint.

expmod (base, exp, mod)

The expmod function returns baseexp mod mod.

eq (i1, i2)

The eq function is a simple comparison of two IPints, which returns 1 if the two are equal, 0 otherwise.



[Top] [Prev] [Next]

infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights reserved.