# Numerics 0.57 released (Hashtables, Bugfix)

1. The main purpose of the release is to implement hash tables (aka associative arrays) with keys of BigCardinal or BigInteger type; such hash tables are important for cryptographic applications. The hash tables in Delphi are implemented by a generic TDictionary<TKey,TValue> class. The release includes a new unit GNumerics.pas with two helper generic classes TBigIntegerDictionary<TValue> and TBigCardinalDictionary<TValue> specializing the base generic dictionary class. For example to work with a hash table having BigInteger keys and string values you need something like this:

```uses GNumerics;

[..]
var
HashTable: TBigIntegerDictionary<string>;
A: BigInteger;

[..]
begin
// create hash table instance
HashTable:= TBigIntegerDictionary<string>.Create;
A:= BigInteger('1234567890987654321');
try
// fill hash table with data
HashTable.Add(A * A, 'some string value');
[..]
finally
// destroy hash table
HashTable.Free;
end;
end;
```

2. Some bugs fixed; in particular a nasty access violation bug in BigInteger.ModPow function was fixed.

3. Minor changes in BigCardinal/BigInteger methods.

Update

Version 0.58 fixes the conversion bug from (U)Int64 to BigInteger/BigCardinal.

## 2 thoughts on “Numerics 0.57 released (Hashtables, Bugfix)”

1. Dr. Diethelm Heumann says:

Hello! I like the idea of this Library! But if found a bug in trying this code:

Procedure TestIt;
Var b1, b2,
result : BigInteger;
i1 : UInt64;
begin
i1 := 5000000000;
b1 := i1;
b2 := 5000000000;
Writeln (‘b1:’, b1.toString);
Writeln (‘b1:’, b2.toString);
result := b1 * b2;
Writeln (‘Result of b1 * b2: ‘, result.toString);
end;

It seems as if the assignment of int64- or uint64-values does not work above the 32-Bit limit.
Result should be 25000000000000000000.
But the assignments to b1 and b2 delivers a value of 705032704 and therfore the result ist 497071113709551616.

• Thank you!

It is a “one-line-of-code-missed” bug; I will release a fix in a day or two.