[DGD] ASN, how to use them?

Felix A. Croes felix at dworkin.nl
Fri Oct 8 14:54:47 CEST 2010


=?ISO-8859-1?Q?Petter_Nystr=F6m?= <jimorie at gmail.com> wrote:

> I have a situation where I thought I could make use of the Arbitrary
> Sized Numbers, that was introduced in DGD around version 1.2.55. But I
> could use some explanations to get started.
>
> 1. What's with the modulus argument? I don't usually involve a modulus
> when I do arithmetic operations on two numbers!

Whenever you are working with integers in LPC, you are working with an
implied modulus of 2 ** 32.  Often, one wants to use ASN to implement
numbers that are not of arbitrary size, but merely larger than ordinary
integers; for example, 64 bit or 128 bit numbers.

But the real reason is that ASN can be used for cryptography, especially
the asn_mult() and asn_pow() functions, and when used for that purpose
the modulus is required.  As is often the case with DGD, what is provided
is pretty low-level, and you may want to wrap it in a layer of LPC code
before you make use of it.

Regards,
Felix Croes



More information about the DGD mailing list