In order to generate and store my passwords, I decided to use a tabula recta as described in this article. So I coded a simple C program to create such a table, I wanted to know if it contained a security hole that could be exploited.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char* alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
unsigned long i, j;
/* Print the header */
printf(" ");
for (i = 0; i < strlen(alphabet); i++)
printf(" %c", alphabet[i]);
printf("\n +");
for (i = 0; i < strlen(alphabet); i++)
printf("--");
/* Print the rest of the table */
printf("\n");
for (i = 0; i < strlen(alphabet); i++) {
printf("%c | ", alphabet[i]);
for (j = 0; j < strlen(alphabet); j++)
printf("%c ", (char) (arc4random_uniform(94) + 33));
printf("\n");
}
}
I don't intend to display the table in the standard output but to redirect it (maybe to a script that will make a postscript file out of it and print it on actual paper).
(Example of vulnerability in a previous version of the program) I used the standard input to ask the user to set a seed to be used by the rand
function. However, it was then possible to brute force all potential seeds (i.e. unsigned integers) and obtain a dictionary of a reasonable size of potential passwords.