Mercurial > public > cpp-enigma
comparison enigma/machine.h @ 17:b04dea5f71a3
process_data() uses step() now.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 07 Jul 2012 15:03:39 -0500 |
parents | 280facb82b80 |
children |
comparison
equal
deleted
inserted
replaced
16:280facb82b80 | 17:b04dea5f71a3 |
---|---|
198 // Process a buffer of pre-processed text of length n, placing the result in an output buffer. | 198 // Process a buffer of pre-processed text of length n, placing the result in an output buffer. |
199 void process_data(const char* input, char* output, std::size_t n) | 199 void process_data(const char* input, char* output, std::size_t n) |
200 { | 200 { |
201 for (std::size_t i = 0; i < n; ++i) | 201 for (std::size_t i = 0; i < n; ++i) |
202 { | 202 { |
203 step_rotors(); | 203 *output++ = step(*input++) + 'A'; |
204 *output++ = electric_signal(*input++) + 'A'; | |
205 } | 204 } |
206 } | 205 } |
207 | 206 |
208 // for access to the plugboard for hill-climbing, etc | 207 // for access to the plugboard for hill-climbing, etc |
209 plugboard& get_plugboard() { return pb; } | 208 plugboard& get_plugboard() { return pb; } |