Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I'm trying to program a Cardan grille, but I can't find requirements for grille. In my case, grille is square matrix A with $N$ x $N$ size, and elements are $0$ or $1$ (where $1$ means that it is hole).

I realized that if $N$ is odd, central element of matrix can not be $1$.

But what are the other requirements?

UPD 30.09.13

Wiki article in russian describes that, if matrix is square, it can be rotated four times around the center.

For example (If I understand correctly):
HELLO and matrix 3x3 with two holes

1 0 0 | H 0 0
0 0 0 | 0 0 0
0 1 0 | 0 E 0

0 0 1 | H 0 L
1 0 0 | L 0 0
0 0 0 | 0 E 0

0 1 0 | H O L
0 0 0 | L 0 0
0 0 1 | 0 E 0

0 0 0
0 0 1
1 0 0

In this expamle three rotations are enough.

As result we have matrix

H O L
L 0 0
0 E 0

And 0 will be replaced by the symbols A-Z. It isn't Cardan grille? What it is name of these method?

If we have central element 1, that symbol well be replaced by other.

1 0 0 | H 0 0
0 1 0 | 0 E 0
0 0 0 | 0 0 0

0 0 1 | H 0 L
0 1 0 | 0 L 0
0 0 0 | 0 0 0

...

So, matrix has some requirements, which I'm trying to find.

share|improve this question
1  
Actually, I am not sure the limitation on the central element is as you think it is, you should be able to cut out holes in any location that text can be, as long as the distribution is not easily guessable. –  Richie Frame Sep 28 '13 at 9:51
2  
as per your update question "It isn't Cardan grille?", the answer is not really. That is just a generalized grille, a Cardan grille is for use with printed text, and implementing it in code makes no sense. Additionally, rotating the grille is not a requirement. –  Richie Frame Sep 30 '13 at 6:06
    
I don't understand the question. What makes you think there are any requirements on the grille? Where does this talk of rotation come from? As far as I know, there is no rotation: you use the grille you have. It looks to me like the question starts from erroneous premises. In any case, I'm having a hard time understanding what you are asking or what the question is; you might need to edit the question to provide more details and more motivation/justification for your assumptions (e.g., what rotation has to do with anything). –  D.W. Sep 30 '13 at 12:21
    
I remember long ago reading some old books on historical ciphers talking about flipping and/or inverting the Cardano grille as an additional (rudimentary) key step. See en.wikipedia.org/wiki/Cardan_grille, which illustrates "Four positions of the grille", and an entire section on turning grilles here: en.wikipedia.org/wiki/Grille_%28cryptography%29#Turning_grilles –  John Deters Sep 30 '13 at 19:37
add comment

2 Answers

up vote 2 down vote accepted

I don't know where you get that the central element can not be $1$, because the Cardan grille does not have any special "requirements" as you're implying. In the original version, a piece of cardboard has several holes cut in it (= the grille) and when it is placed over an innocent looking message, the holes cover all but specific letters spelling out the secret message.

Simpler put: the holes you are cutting, identify the letters of the secret message. The other parts (which are covered) are the text to be ignored.

Let me give you a hint by providing you with a practical example…

The harmless looking, to-be-transmitted message could read:

ALL THOSE TEENIES ARE CRAZY KIDS!

and (taking your boolean $1$ and $0$ approach) the grille could look like this:

100010000010000000100010000010001

then the hidden message would be readable by applying the grille like this:

ALL THOSE TEENIES ARE CRAZY KIDS!
100010000010000000100010000010001
A...T.....T.......A...C.....K...!

ATTACK!

That's all that's to it. So, there are no other requirements but the obvious one: if someone puts the grille on your text, only the hidden message should be readable…

In other words (and to answer your question by the letter): the only requirement of the grille is to have "holes" where the hidden message's letters, numbers, and/or symbols are located, so that when the grille is applied to a harmless looking message (like a letter or book page), the hidden message is the only thing that remains visible because everything else is covered by the grille.

You might want to check Wikipedia's related article if you need another, more classical example.

EDIT

Looking at your edit, it becomes obvious that there's an additional step you're talking about... meaning we're indeed not talking about a pure "Cardan grille". A pure "Cardan grille" would not touch/change the text the grille is applied to. It's just a paper with holes showing you what letters of the plaintext are the secret message.

The rotating matrix your latest edit shows is something completely different. It could be called a grille cipher, but it's definitely not a Cardan grille… it could be a derived Fleissner grille (also known as "turning grille"), but I would need to be able to check the article you've been reading (see my link-request). It could well be that the article you've been reading talks about multiple grille cyphers; maybe even a combination of them. Until I've read that article , I can only guess… Fleissner grille.

If it's a Fleissner grille (or derivate), you might want to look at this related PDF which explains them (as well as attacks on it). Besides that, this website practically explains the Methods of Transposition as used in the Turning grille, including the center symbol thing you've noticed and are asking about.

You'll notice this image of a turning grille in action also has that 3x3 matrix in it's inner ring. screenshot showing turning grille in action

As for the 3x3 matrix itself, it's logical that if you rotate it around the middle, the symbol at the center will not move/change. Yet, I expect that what your edit shows is just part of multiple steps of remixing the 3x3 matrix. Otherwise, you're indeed correct - the non-changing center symbol would be one of the weakest parts of the matrix-mixing process.

As for the requirements of mixing, rotating and shifting a matrix… that is defined by the individual cipher implementation, not via generalized rules that apply to every cipher.

share|improve this answer
    
I added an example that can concretize my question. Take a look please. –  Igor Chemidov Sep 30 '13 at 4:44
    
@IgorCh. Added an edit to my answer. It would be cool if you could share a link to the Russian article you're mentioning so I can take a look at it. (No worries, I will be able to read and understand the article.) I'm sure that reading it will enable me (and others) to help you a bit better. –  e-sushi Sep 30 '13 at 18:58
    
@IgorCh. As for your question about what kind of grille it is: I'm pretty confident it's a turning grille. Check the image in my answer's edit… it should look familiar. ;) –  e-sushi Sep 30 '13 at 21:02
    
Cardan grille - Russian; specifically: " Если решетка Кардано - квадрат, то возможен второй вариант размещений сетки, а именно, последовательные повороты вокруг центра квадрата на 90°.". I think, turning grille is what I need. –  Igor Chemidov Oct 1 '13 at 14:09
    
@IgorCh. Aah, that explains the confusion. Wikipedia не всегда может быть правильным. ;) Пока! –  e-sushi Oct 1 '13 at 14:29
add comment

I think you're referring to Fleissner grilles, which are kind of a subset of Cardan grilles. According to wikipedia, to construct one you "make 16 perforations in an 8x8 grid – 4 holes in each quadrant. If the squares in each quadrant are [identically] numbered 1 to 16, all 16 numbers must be used once only. This allows many variations in placing the apertures." That's likely the requirement you're trying to find.

I edited your question to change the title from "Cardan grille" to "Fleissner grille". The use of the incorrect name has led people to make incorrect assumptions about what you're trying to accomplish.

The difference between the two is important. Traditional Cardan grilles are used to hide a few secret letters inside a large body of plaintext. The author writes the secret message through the holes, then adds innocuous text to disguise the hidden message, perhaps as a letter to a loved one. It's primarily a form of steganography, which hides the fact that there is a secret message. The Fleissner grille makes no pretense of wearing a disguise - it's a square of meaningless-looking letters. To anyone reading your mail, it's a very suspicious thing to find.

All grilles are simply transposition ciphers. The reason for using the grille is to make the task of encoding and decoding easier for the human operator. Without the grille, encoding and decoding instructions become a list of characters: row 1 column 8, row 2 column 12, etc., which are tedious for a human to use. That's especially a problem under the stress of hurriedly writing a secret message that could bring a charge of treason should you be caught!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.