This is the documentation page for Module:RadioGatun32


UsageEdit

This module calculates the RadioGatún[32] sum for a given string, returning it in a format suitable for showing a demonstration sum on a Wikipedia page. RadioGatún is a cryptographic hash function from 2006 which remains, as of 2022, unbroken.

To use:

{{#invoke:RadioGatun32|rg32|String to input}}

Or with the template (at Template:RadioGatun32):

{{RadioGatun32|String to input}}

If there is {{Background color|#888|d}} in the string to input, the calculated sum will be based on a string without the background color formatting.

The rg32hash callEdit

It is also possible to show the raw hexadecimal RadioGatun[32] sum of a given string without any formatting:

{{#invoke:RadioGatun32|rg32sum|String to input}}

For example, if we run:

{{#invoke:RadioGatun32|rg32sum|1234}}

We will get this:

9EBDD24F469993796C4AAC6A821735A65A3CDEF8A359944CE71F34E7A08E1182

This should output "9EBDD24F469993796C4AAC6A821735A65A3CDEF8A359944CE71F34E7A08E1182".

ExamplesEdit

{{#invoke:RadioGatun32|rg32|Hello, world}}

Will create this output:

RadioGatun[32]("Hello, world") =
D91BBD22BE5D01F091F26A16704CDA0E165588E025D9BA6619C5B01550756349

Here is the computed output:

RadioGatun[32]("Hello, world") =
D91BBD22BE5D01F091F26A16704CDA0E165588E025D9BA6619C5B01550756349

We can have background colors:

{{#invoke:RadioGatun32|rg32|{{Background color|#ff8cc0|Li}}{{Background color|#c08dff|fe}}!}}

Shows us this:

RadioGatun[32]("Template:Background colorTemplate:Background color!") =
8B14915DF10B04CF6DE9BBAD6A2FACC6855EAB4D618255626DDD3B0DFB9A95AC

The above should look exactly like this:

RadioGatun[32]("Template:Background colorTemplate:Background color!") =
80E706E851DCDE1170452EEC6EAD24F40E63B9A07B86D8D32053A1237835E03D

The computed sum will be for the string Life!, as can be seen in the following:

RadioGatun[32]("Life!") =
80E706E851DCDE1170452EEC6EAD24F40E63B9A07B86D8D32053A1237835E03D

The above should look like this:

RadioGatun[32]("Life!") =
80E706E851DCDE1170452EEC6EAD24F40E63B9A07B86D8D32053A1237835E03D

The background colors do not affect the computed RadioGatun[32] sum.

TestingEdit

Testing inside MediawikiEdit

To test this in Mediawiki, go to Module talk:RadioGatun32/testcases, and verify that one sees "All RadioGatun[32] test vectors pass". One can rerun the test by going to Module:RadioGatun32/testcases, clicking on "edit this page", then in the debug console at the bottom, typing in print(p.test()). One should then see "All RadioGatun[32] test vectors pass".

Another way to test this is to add {{#invoke:RadioGatun32/testcases|test}} to a page; wherever RadioGatun32/test is invoked, it should show "All RadioGatun[32] test vectors pass".

Testing outside MediawikiEdit

This module can either be run as a Mediawiki Lua module, or as a standalone Lua script. This very same script is also available on GitHub in a repo which includes automated tests to ensure implementations of RadioGatun[32] generate correct hashes against a number of test inputs, including all official RadioGatun[32] test vectors.

To test this code, in a *NIX compatible environment like Linux, with Git and a version of Lua above 5.1 and below 5.4 (Lua 5.4 dropped bit32; a Lua 5.1 implementation with bit32 support will also work), do the following:

git clone https://github.com/samboy/rg32hash
cd rg32hash/sqa
./do.test.sh ../Lua/rg32wiki.sh

See alsoEdit