Mercurial > public > cpp-enigma
comparison enigma/enigma_utils.cpp @ 12:424111a36ed7
Created enigma_machine::process_data() for some speed improvements.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 01 Jul 2012 12:53:10 -0500 |
parents | 2792ca4ffa84 |
children |
comparison
equal
deleted
inserted
replaced
11:da231533c5c7 | 12:424111a36ed7 |
---|---|
18 result += c; | 18 result += c; |
19 } | 19 } |
20 } | 20 } |
21 return result; | 21 return result; |
22 } | 22 } |
23 | |
24 //////////////////////////////////////////////////////////////////////////////// | |
25 | |
26 std::string enigma::preprocess_ciphertext(const std::string& s) | |
27 { | |
28 std::string result; | |
29 result.reserve(s.size()); | |
30 | |
31 for (const auto& c : s) | |
32 { | |
33 if (c != ' ') | |
34 { | |
35 result += c - 'A'; | |
36 } | |
37 } | |
38 return result; | |
39 } |