openGPMP
Open Source Mathematics Package
cipher.hpp
Go to the documentation of this file.
1 /*************************************************************************
2  *
3  * Project
4  * _____ _____ __ __ _____
5  * / ____| __ \| \/ | __ \
6  * ___ _ __ ___ _ __ | | __| |__) | \ / | |__) |
7  * / _ \| '_ \ / _ \ '_ \| | |_ | ___/| |\/| | ___/
8  *| (_) | |_) | __/ | | | |__| | | | | | | |
9  * \___/| .__/ \___|_| |_|\_____|_| |_| |_|_|
10  * | |
11  * |_|
12  *
13  * Copyright (C) Akiel Aries, <akiel@akiel.org>, et al.
14  *
15  * This software is licensed as described in the file LICENSE, which
16  * you should have received as part of this distribution. The terms
17  * among other details are referenced in the official documentation
18  * seen here : https://akielaries.github.io/openGPMP/ along with
19  * important files seen in this project.
20  *
21  * You may opt to use, copy, modify, merge, publish, distribute
22  * and/or sell copies of the Software, and permit persons to whom
23  * the Software is furnished to do so, under the terms of the
24  * LICENSE file. As this is an Open Source effort, all implementations
25  * must be of the same methodology.
26  *
27  *
28  *
29  * This software is distributed on an AS IS basis, WITHOUT
30  * WARRANTY OF ANY KIND, either express or implied.
31  *
32  ************************************************************************/
33 
34 /*
35  * definitions for openGPMP naive ciphers
36  */
37 
38 #ifndef CIPHER_H
39 #define CIPHER_H
40 #include <stdint.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <string.h>
44 #include <string>
45 
46 namespace gpmp {
47 
48 // monoalphabetic substitution cipher class
49 class Cipher {
50  public:
51  /* compute the caesar cipher of a given string with a shift key */
52  std::string caesar(std::string plaintext, int64_t key);
53  /* encode and prepare the given string for the cipher */
54  std::string keyword_encode(std::string key);
55  /* compute the keyword cipher of a given string */
56  std::string keyword(std::string plaintext, std::string encoded_text);
57 };
58 
59 } // namespace gpmp
60 
61 #endif
std::string keyword_encode(std::string key)
Definition: cipher.cpp:63
std::string keyword(std::string plaintext, std::string encoded_text)
Definition: cipher.cpp:99
std::string caesar(std::string plaintext, int64_t key)
Definition: cipher.cpp:46
The source C++ openGPMP namespace.