[Top] [Prev] [Next]


Keyring: IPint - infinite precision integer utility functions


include "keyring.m"
keyring:= load Keyring Keyring->PATH;
#infinite precision integers
IPint: adt
  x:    int;
  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;
  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;


The IPint adt provides integer manipulation functions required for cryptographic support in Limbo. The iptob64 function converts a large integer to a base 64 string for convenient transmission over a network connection. The b64toip function performs the inverse operation. The iptobytes function converts an 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. The 'operations' functions manipulate IPint types 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 IPint that returns 1 if the two are equal, 0 otherwise.

See Also

B. Schneier, Applied Cryptography, 1996, J. Wiley & Sons, Inc.

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.