Decrypt messages and calculate Pi: new OctaPi projects

Back in July, we collaborated with GCHQ to bring you two fantastic free resources: the first showed you how to build an OctaPi, a Raspberry Pi cluster computer. The second showed you how to use the cluster to learn about public key cryptography. Since then, we and GCHQ have been hard at work, and now we’re presenting two more exciting projects to make with your OctaPi!

A happy cartoon octopus holds a Raspberry Pi in each tentacle.

Maker level

These new free resources are at the Maker level of the Raspberry Pi Foundation Digital Making Curriculum — they are intended for learners with a fair amount of experience, introducing them to some intriguing new concepts.

Whilst both resources make use of the OctaPi in their final steps, you can work through the majority of the projects on any computer running Python 3.

Calculate Pi

A cartoon octopus is struggling to work out the value of Pi


Calculating Pi teaches you two ways of calculating the value of Pi with varying accuracy. Along the way, you’ll also learn how computers store numbers with a fractional part, why your computer can limit how accurate your calculation of Pi is, and how to distribute the calculation across the OctaPi cluster.

Brute-force Enigma

A cartoon octopus tries to break an Enigma code

Decrypt the message before time runs out!

Brute-force Enigma sends you back in time to take up the position of a WWII Enigma operator. Learn how to encrypt and decrypt messages using an Enigma machine simulated entirely in Python. Then switch roles and become a Bletchley Park code breaker — except this time, you’ve got a cluster computer on your side! You will use the OctaPi to launch a brute-force crypt attack on an Enigma-encrypted message, and you’ll gain an appreciation of just how difficult this decryption task was without computers.

Our own OctaPi

A GIF of the OctaPi cluster computer at Pi Towers
GCHQ has kindly sent us a fully assembled, very pretty OctaPi of our own to play with at Pi Towers — it even has eight snazzy Unicorn HATs which let you display light patterns and visualize simulations! Visitors of the Raspberry Jam at Pi Towers can have a go at running their own programs on the OctaPi, while we’ll be using it to continue to curate more free resources for you.

If you’d like to find out more about cluster computing with the Raspberry Pi, read tomorrow’s blog post!



Dear Father Christmas, if you happen to work for GCHQ I am certain all my computing pupils have been good this year. If you are watching an OctaPi would be a very nice present for them all to learn to do wonderful things with.

In the mean time these activities are wonderful and certainly give us lots of ideas to try ourselves.


P.S. Hi Father Christmas. While you’re here, I would like a pony. Thank you in advance. Alex x

(Glad you like the resources, Lucas!)


I bet this would be cool with Unicorn Hat HD. Has this been tested?


Kids these days – they are so spoiled. Why I remember having to go to university first AND have to take several special classes before I could even be allowed to remotely run code on a 4 node CM supercomputer. The actual machine took up a whole room with students not having physical access, but could only gawk at it in amazement through floor to ceiling glass. Now these kids can just throw an OctaPi into their backpacks to play around with at any time…


I like both the calculating Pi and the Enigma code breaking projects. Both contain history and background about how computers work which fit well with the final step of running a parallel computation. Although Python may not be the language of high performance computing nor Pi computers the hardware of choice, using these two tools really makes ideas accessible to students who could then be inspired to learn more and do something new on their own. How many hours does it generally take for a motivated student in a computing class or club to complete one of these projects?


Glad you liked the resources, Eric! I think the length of time depends entirely on the student. I’d estimate that each resource might take a confident student about 2-3 hours, but certainly longer if they need to set up the OctaPi as well. The resources would also work well for students to complete in groups or as part of a workshop.


Thanks for your reply. I’ve been studying the two projects and am puzzled by the statement in the parallel processing section of both that the client machine may run out of memory. The explanation given is that each running job takes up storage space on the client machine. This surprises me because the computation is running on the servers and the client only collects the results. Is this memory limitation in the Dispi library code? Does it affect an eight-node OctaPi or only a larger one?


In the last blog post Bruce Pulloch said that Los Alamos is up to a 3000-Pi cluster…


Fun side note: I’d be willing to bet that the purple octopus in the cartoons is Stretch (


If only my school would do this. I would learn so much about decryption and calculations…..

Leave a Comment

Comments are closed