An ANSI C89, fast and efficient implementation of Caesar and Vigenère cipher.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

3.4 KiB


An ANSI C89, fast and efficient implementation of Caesar and Vigenère cipher.


$ cd src && make This will create an executable called fcvc (as well as all the object files) in the src directory.

To indent the source code you must install indent, then run: $ make indent.

You can see all the available targets with $ cat Makefile


Usage: fcvc {OPTION1} [OPTION2]
An ANSI C, fast and efficient implementation of Caesar and Vigenere cipher.

Only one or two options are permitted.
        fcvc {-a,-v} "INPUT STRING"
        fcvc -k KEY {-c,-d} "INPUT STRING"

        -a      Try all 26 alphabets for the INPUT STRING.
        -c      Encipher INPUT STRING.
        -d      Decipher INPUT STRING.
        -h      Print this help.
        -k      Use KEY to encipher or decipher INPUT STRING.
        -v      Decipher Vigenere INPUT STRING.

Exit value:
        0       no error occurred,
        != 0    some error occurred.

Report bugs to: or
Full documentation at: <>
or available locally via: fcvc -h

fast-caesar-vigenere-cipher  Copyright © 2016  frnmst (Franco Masotti)
This program comes with ABSOLUTELY NO WARRANTY; for details see
'LICENSE' file or <>
This is free software, and you are welcome to redistribute it
under certain conditions; see 'LICENSE' file or
<> for details.


Tabula recta

Since Vigenère's cipher is a general case of Caesar cipher they can be implemented in the same function.

Each row of the table represents one of the possible enciphering alphabets, and each column the value of the input string transformed in the corresponding alphabet.

In the case of Caesar cipher the user select an alphabet for the whole input string, while in the case of Vigenère the alphabet (row) changes for each letter of the input string. This set of chosen alphabets is known as the key. If the length of key is less than the length of the input string then the key is wrapped to the beginning.


Simon Singh has written an excellent intoductory book about cryptography called "The Code Book". At the end of his book and on his website there are Caesar shift cryptograms examples you can test like this:


where EXAMPLE CRYPTOGRAM is a string that can contain non-alphabetical characters. This will crack the cryptogram by iterating through all the possible 26 alphabets.

A Vigenère cracker will also be available in the future through the -v option. Cracking Vigenère's cipher, however, requires much more effort, design and research than Caesar's cipher.


Copyright (C) 2016 frnmst (Franco Masotti)

fast-caesar-vigenere-cipher is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.