annotate enigma/rotor_data.h @ 4:2792ca4ffa84

Created enigma_machine class and tests.
author Brian Neal <bgneal@gmail.com>
date Sun, 24 Jun 2012 18:39:05 -0500
parents 1459e74fda3f
children
rev   line source
bgneal@1 1 #ifndef CPP_ENIGMA_ROTOR_DATA_H
bgneal@1 2 #define CPP_ENIGMA_ROTOR_DATA_H
bgneal@1 3 // Copyright (C) 2012 by Brian Neal.
bgneal@1 4 // This file is part of Cpp-Enigma, the Enigma Machine simulation.
bgneal@1 5 // Cpp-Enigma is released under the MIT License (see License.txt).
bgneal@1 6 //
bgneal@1 7 // rotor_data.h - This file contains standard rotor & reflector data.
bgneal@1 8
bgneal@1 9 #include <map>
bgneal@1 10 #include <string>
bgneal@1 11
bgneal@1 12 namespace enigma
bgneal@1 13 {
bgneal@1 14 struct rotor_data
bgneal@1 15 {
bgneal@1 16 const char* wiring;
bgneal@1 17 const char* stepping;
bgneal@1 18 };
bgneal@1 19
bgneal@1 20 typedef std::map<std::string, rotor_data> rotor_data_map;
bgneal@1 21
bgneal@1 22 const rotor_data_map simulated_rotors
bgneal@1 23 {
bgneal@1 24 { "I", { "EKMFLGDQVZNTOWYHXUSPAIBRCJ", "Q" } },
bgneal@1 25 { "II", { "AJDKSIRUXBLHWTMCQGZNPYFVOE", "E" } },
bgneal@1 26 { "III", { "BDFHJLCPRTXVZNYEIWGAKMUSQO", "V" } },
bgneal@1 27 { "IV", { "ESOVPZJAYQUIRHXLNFTGKDCMWB", "J" } },
bgneal@1 28 { "V", { "VZBRGITYUPSDNHLXAWMJQOFECK", "Z" } },
bgneal@1 29 { "VI", { "JPGVOUMFYQBENHZRDKASXLICTW", "ZM"} },
bgneal@1 30 { "VII", { "NZJHGRCXMYSWBOUFAIVLPEKQDT", "ZM"} },
bgneal@1 31 { "VIII", { "FKQHTLXOCBJSPDZRAMEWNIUYGV", "ZM" } },
bgneal@1 32 { "Beta", { "LEYJVCNIXWPBQMDRTAKZGFUHOS", nullptr } },
bgneal@1 33 { "Gamma", { "FSOKANUERHMBTIYCWLQPZXVGJD", nullptr } },
bgneal@1 34 };
bgneal@1 35
bgneal@1 36 typedef std::map<std::string, const char*> reflector_data_map;
bgneal@1 37
bgneal@1 38 const reflector_data_map simulated_reflectors
bgneal@1 39 {
bgneal@1 40 { "B", "YRUHQSLDPXNGOKMIEBFZCWVJAT" },
bgneal@1 41 { "C", "FVPJIAOYEDRZXWGCTKUQSBNMHL" },
bgneal@1 42 { "B-Thin", "ENKQAUYWJICOPBLMDXZVFTHRGS" },
bgneal@1 43 { "C-Thin", "RDOBJNTKVEHMLFCWZAXGYIPSUQ" },
bgneal@1 44 };
bgneal@1 45 }
bgneal@1 46
bgneal@1 47 #endif