Difference between revisions of "Brion Cipher"
(Base cipher information from sentinel) |
m (Added to quest solutions) |
||
Line 43: | Line 43: | ||
</pre> | </pre> | ||
− | [[Category:Cryptography]] | + | [[Category:Cryptography]] [[Category: Quest Solutions]] |
Revision as of 22:03, 7 January 2008
Thought Process
Borrowing from Tharloch we know the base cypher (remove spaces, rotate letters backwards by their position [counting from 1 after spaces are removed] in the message). The issue then becomes that this method does not work for the later messages.
The solution is then to brute force all 26 possible starting rotations, as any others are redundant. To acomplish this, I borrowed heavily from an implimentation of rot13 in C, but generalized to try all possible initial rotations and changed to backwards rotate by the character's index. The program reads from 'libraries.txt', which needs to be in the same directory as the program, and the spaces removed from the 'libraries.txt' file before running the program. It then outputs all possible translations of each line of the message, as well as the 'key' for that line. That is the index of the first character to create that particular message. All you have to do is look through the output for something that looks english.
#include <stdio.h> // Brion Message brute forcer, by Phroon. int main(void) { int i,j; FILE *fp; char ch; for (j=0;j<26;j++){ fp = fopen("libraries.txt","r"); i = j; printf("%d:",j); while (fscanf(fp,"%c",&ch) != EOF) { if (ch >= 'a' && ch <= 'z') { ch = ch - i%26; if (ch < 'a') ch = ch + 26; } else if (ch >= 'A' && ch <= 'Z') { ch = ch - i%26; if (ch < 'A') ch = ch + 26; } i++; if(ch=='\n') i=j; printf("%c",ch); } } return 0; }