colindean / enigma-simulation

A Scala port of an implementation of The Enigma
1 stars 0 forks source link

Serialize Enigma state #1

Open colindean opened 9 years ago

colindean commented 9 years ago

Output the state of the Enigma before any crypt operation is performed.

colindean commented 9 years ago

I'd like to use JSON that would end up looking something like this:

{"enigma": {
    "plugboard": {
       "A": "B",
       ...
    },
    "reflector": {
       "A": "B",
       ...
    },
    "rotors": [
      { "A": "B", "B":"C"},
      { "A": "B", "B":"C"},
      { "A": "B", "B":"C"},
    ]
}}     

Or, it could be in two files, to be more like the Enigma: distribute a plugboard/reflector file and distribute a set of rotors separately.

colindean commented 9 years ago

Messed around a little with json4s and some others. The interface is best on json4s, but it will require more than just a .toJson call to make it right.

I think I'll need something like a LetterMapSerializer that can turn each mapping's internal Map into JSON cleanly.