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:
<nowiki>{{</nowiki>#invoke:RadioGatun32|''rg32''|''String to input''<nowiki>}}</nowiki>
Or with the template (at):
<nowiki>{{</nowiki>RadioGatun32|''String to input''<nowiki>}}</nowiki>
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.
It is also possible to show the raw hexadecimal RadioGatun[32] sum of a given string without any formatting:
<nowiki>{{#invoke:RadioGatun32|rg32sum|</nowiki>''String to input''<nowiki>}}</nowiki>
For example, if we run:
<nowiki>{{#invoke:RadioGatun32|rg32sum|1234}}</nowiki>
We will get this:
This should output "9EBDD24F469993796C4AAC6A821735A65A3CDEF8A359944CE71F34E7A08E1182".
<nowiki>{{</nowiki>#invoke:RadioGatun32|rg32|Hello, world<nowiki>}}</nowiki>
Will create this output:
RadioGatun[32]("Hello, world") = D91BBD22BE5D01F091F26A16704CDA0E165588E025D9BA6619C5B01550756349
Here is the computed output:
We can have background colors:
<nowiki>{{</nowiki>#invoke:RadioGatun32|rg32|<nowiki>{{</nowiki>Background color|#ff8cc0|Li<nowiki>}}{{</nowiki>Background color|#c08dff|fe<nowiki>}}!}}</nowiki>
Shows us this:
The above should look exactly like this:
RadioGatun[32]("!") = 80E706E851DCDE1170452EEC6EAD24F40E63B9A07B86D8D32053A1237835E03D
The computed sum will be for the string Life!
, as can be seen in the following:
The above should look like this:
RadioGatun[32]("Life!") = 80E706E851DCDE1170452EEC6EAD24F40E63B9A07B86D8D32053A1237835E03D
The background colors do not affect the computed RadioGatun[32] sum.
To test this in Mediawiki, go to, and verify that one sees "All RadioGatun[32] test vectors pass". One can rerun the test by going to, 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 <nowiki>{{#invoke:RadioGatun32/testcases|test}}</nowiki>
to a page; wherever RadioGatun32/test is invoked, it should show "All RadioGatun[32] test vectors pass".
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