[Bro] string to (huge) int/count convert

Siwek, Jon jsiwek at illinois.edu
Wed Dec 3 08:03:25 PST 2014

> On Dec 3, 2014, at 2:52 AM, Sławek Rozbicki <slawek at rozbicki.eu> wrote:
> In order to make IBAN checksum checker I need to make modulo 97
> operation on a very high value that cannot be stored in int or count
> type. Is there any way I could make this possible? there is no 'long'
> type in bro?
> This is exactly what I'm tring to accomplish:
> http://www.ibancalculator.com/calculation.html

The maximum integer storage in Bro is the unsigned 64-bit “count” type.  The numbers in the example seem to overflow that, so maybe an approach to try is to find/port an arbitrary precision modulus algorithm (e.g. one that operates on a string of digits and thus avoids overflowing fixed size storage).  It may be easier to add such a thing as a Built-In Function (using C/C++) rather than entirely in the Bro scripting language.

- Jon

More information about the Bro mailing list