Encryption and decryption with vector and rotor?

Im working on this project requiring using vector and rotors to do the encryption and decryption. I have no idea where to start. Any expert who can help?

http://i.imgur.com/Sit2KbW.png
Make a class with a constructor taking the multiplier/divisor and the addition/subtraction parameter.

Have a public method to encode, and a public method to decode. Each should take a collection class as parameter, and return the same type of collection class.

eg:
1
2
3
4
5
6
7
class MultAdd {
...
public:
  MultAdd(int m, int a);
  std::list<int> encode(const std::list<int>&) const;
  std::list<int> decode(const std::list<int>&) const;
};


Then you will be able to test like this:

1
2
3
4
5
6
7
8
9
MultAdd a(3,5), b(4, 8), c(2, 6), d(7, 9);

list<int> message;
message.push_back(65);
message.push_back(115);

std::list<int> encoded_message = d.encode(c.encode(b.encode(a.encode(message))));

std::list<int> decoded_message = a.decode(b.decode(c.decode(d.decode(encoded_message))));


You will be able to test it more simply step by step with something like:

1
2
std::list<int> x = a.encode(message);
std::list<int> y = a.decode(x);

Last edited on
Topic archived. No new replies allowed.