Cipher Grid Generator
by ridercz, published
Use This Project
Give a Shout Out
If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.Print Thing Tag
Grid Cipher (sometimes also called a grid code) is very simple transposition block symmetric encryption algorithm. It is not usable for any serious cryptography nowadays, but still can be used for games and entertainment.
Traditionally, the grids are created by hand by cutting them from paper. But this process is tedious and prone to errors. So I automated it using 3D printer.
This SCAD file will randomly generate a valid cipher grid each time it's rendered. See variables in source code for customization options. For your convenience, there are several pre-generated grids available for download, if you don't have OpenSCAD installed.
I recommend that you print this model three layers tall. The default settings are for 3 x 0.2 = 0.6 mm height.
How To Encrypt
- Place the grid on paper and remember its orientation. Use the smooth/rough side difference and the round keying hole to note the position.
- Write letters of your message to the square holes.
- When you fill in all holes, spin the grid 90° and continue writing.
- You have to write message which is exactly 100 characters long (for 10x10 grid). If your message is shorter, pad the rest with gibberish. If longer, continue writing another square.
How To Decrypt
- Obtain the same grid that was used for encryption.
- Place it over the encrypted text in the same orientation as when encrypted.
- Read letters showing trough holes.
- Spin the grid 90° and continue reading.
How I Designed This
The design of the cipher grid is simple, see the scheme above. The grid is divided into four quadrants. The cells are numbered (see the numbers as index for row and column, ie. "23" in the top right quadrant is row 2, column 3). When the grid is rotated by 90°, hole made in the cell will move to cell with the same number in the next quadrant.
The algorithm to create the code grids is therefore simple: for each position (from "11" to "44" in the picture above) select randomly a quadrant where the hole will be placed. In the code, there are two loops for
iy (as in index x and index y) variables and the
cy (center x/y variables are determined to compute center of the hole, relative to the quadrant). The
iq variable, which determines quadrant, is selected randomly, as is therefore the real placement of the hole.
The outermost cell ("44" in the scheme above) is given a bit of special treatment. I need to place the keying hole (which will allow to note the grid rotation) somewhere. I put it into top right corner of the grid (quandrant 0). However, if the last cell hole is placed in Q0, the key hole is moved to Q2.
Upgrade this Thing with Thingiverse AppsCustomization
Edit, personalize, or revise this ThingTools and Utilities
Repair, slice, or enhance this Thing
Cipher Grid Generator by ridercz is licensed under the Creative Commons - Attribution - Non-Commercial - Share Alike license.
What does this mean?
- You must attribute (give credit) to the creator of this Thing.
- You must distribute Remixes under the same license as the original.
- Remixing or Changing this Thing is allowed.
- Commercial use is not allowed.
Show Some Love
Say thanks by giving ridercz a tip and help them continue to share amazing Things with the Thingiverse community.Tip Designer
We're sure ridercz would love to see what you've printed. Please document your print and share a Make with the community.
To post a Make simply visit this Thing again and click I Made One to start uploading your photo. It’s even easier to post a Make via the Thingiverse Mobile app (available via Google Play and Apple App Store).