# A Toy Program in Magma

By [PQCRAINBOW.ETH](https://paragraph.com/@pqcrainbow) · 2021-12-30

---

Here is a Magma program for someone who wants to play with Rainbow.

[This file](https://drive.google.com/file/d/1wb6LD9vi4M9C5Za1-P2fBFob0mE1-pgK/view?usp=sharing) is a toy Magma Rainbow program, which can run on Magma or the online magma calculator

[http://magma.maths.usyd.edu.au/calc/](http://www.google.com/url?q=http%3A%2F%2Fmagma.maths.usyd.edu.au%2Fcalc%2F&sa=D&sntz=1&usg=AFQjCNEJ841c-Ohso49BdXf2IEiWTOCaOw)

In the calculator, one has to copy and paste the program into the window of the calculator and then press the submit button.

You can change anything in the program, in particular, the parameters for Rainbow at the beginning of the code which can be modified as you want. The three number in parameters vector are v\_1, o\_1 and o\_2, which is set to be \[ 3, 2, 2\] for now.

The program will generate the public and private keys, it will then create a random hashvalue, which will be signed. The signature is then verified in the last part of the program with the help of the public key.

Normally this program would be implemented in three separate programs with the keys passed on in external files. The magma calculator does not allow for external files, therefore everything is done immediately in sequence.

---

*Originally published on [PQCRAINBOW.ETH](https://paragraph.com/@pqcrainbow/a-toy-program-in-magma)*
