Search for a tool
Swagman Cipher

Tool for encrypting and decrypting messages with the Swagman cipher, a transposition cipher using a key grid.

Results

Swagman Cipher -

Tag(s) : Transposition Cipher, Grid Cipher

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Swagman Cipher' tool for free! Thank you!

Swagman Cipher

Swagman Decoder

 

Loading...
(if this message do not disappear, try to refresh this page)
See also: Latin Square

Swagman Encoder

 



Loading...
(if this message do not disappear, try to refresh this page)


Answers to Questions (FAQ)

What is the Swagman cipher? (Definition)

The Swagman cipher is a transposition cipher based on a Latin square of size N. The key grid contains the numbers from 1 to N, without repetition in any row or column.

How to encrypt a message with Swagman?

Choose a grid size N (usually between 4 and 8) and generate a Latin square containing the numbers from 1 to N, without repetition in any row or column.

Example: A Latin square of size N=4

1324
3412
2143
4231

The plaintext is then written horizontally into a table of N rows and padding letters, called nulls, are added if necessary to complete the table.

Example: Encrypt the message DCODESWAGMANCIPHER by writing it as

DCODE
SWAGM
ANCIP
HERXX

For each column, perform a permutation of the letters: look at the numbers in the corresponding column of the key grid and read the letters according to the numerical order.

Example: The first column is 1,3,2,4, so the letters are: D (row 1), A (row 3), S (row 2) and H (row 4), etc. The table becomes:

DNAXE
AEOGP
SCRIM
HWCDX

The table is read column by column to form the final ciphertext (all column letter sequences are concatenated).

Example: The encrypted message is: DASHNECWAORCXGIDEPMX

How to decrypt a message encrypted with Swagman?

Decrypting Swagman requires knowing the grid (Latin square).

Example: Decrypt DASHNECWAORCXGIDEPMX with the grid

1324
3412
2143
4231

— Determine the dimensions of the rectangle from the number of rows N in the grid. The number of columns is the length of the raw ciphertext divided by N.

Example: The square has size N=4, the message contains 20 letters, so the table has 5 columns.

— Reconstruct the table by copying the ciphertext column by column

Example:

DNAXE
AEOGP
SCRIM
HWCDX

— For each column: use the key grid to recover the original row order and place the letters back into their correct positions.

Example:

DCODE
SWAGM
ANCIP
HERXX

— Then read the table horizontally, row by row, to recover the plaintext.

How to recognize a text encrypted with Swagman?

The Swagman cipher is a transposition cipher: the letters of the text are rearranged, but they are not replaced. The index of coincidence therefore remains identical to the plaintext (letter frequencies remain those of the original language).

The presence of a Latin square similar to a Sudoku grid is a clue.

What to do if the key grid is unknown during decryption?

If the key grid is unknown, it is necessary to test different values of N, then attempt to reconstruct the text column by column.

To achieve this, it is possible to check whether the result contains plausible words or structures in the target language. A partially known plaintext can help reconstruct the grid.

How to generate a valid key grid for Swagman?

A valid key grid for Swagman is a Latin square of size NxN. This means that each row and each column contains every number from 1 to N exactly once.

A simple way to generate a Latin square is to list the numbers in ascending order on the first row, then circularly shift them by 1 on each following row.

Example:

1234
2341
3412
4123

Any row or column permutation (such as swapping 2 or more rows or columns) preserves the property that the grid remains a Latin square.

Source code

dCode retains ownership of the "Swagman Cipher" source code. Any algorithm for the "Swagman Cipher" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Swagman Cipher" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Swagman Cipher" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Swagman Cipher" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).

Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).

To cite dCode.fr on another website, use the link: https://www.dcode.fr/swagman-cipher

In a scientific article or book, the recommended bibliographic citation is: Swagman Cipher on dCode.fr [online website], retrieved on 2026-05-20, https://www.dcode.fr/swagman-cipher

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Swagman Cipher' tool for free! Thank you!


https://www.dcode.fr/swagman-cipher
© 2026 dCode — The ultimate collection of tools for games, math, and puzzles.
â–˛  
Feedback