See the openGPMP/samples folder for many more examples on how to use openGPMP.
Example C++ driver file for running Caesar Cipher & Mono-Alphabetic Substitution Keyword cipher:
#include <iostream>
#include <string>
std::string text0 = "Plaintext";
int shift_key_0 = 5;
std::string hashtext_0 = cc.C_cipher(text0, shift_key_0);
std::cout << "Hashtext0 = " << hashtext_0 << std::endl;
std::string shift_key_2 = "Computer";
std::string text2 = "Password";
std::string encoded_text = cc.KC_encode(shift_key_2);
std::string hashtext_2 = cc.KC_cipher(text2 , encoded_text);
std::cout << "Hashtext2 = " << hashtext_2 << std::endl;
return 0;
}
int main(int argc, char **argv)
User API for OpenGPMP NUMBER THEORY MODULE.
A Python example showing the same functionalities.
#!/usr/bin/python3
from pygpmp import nt
def main():
c = nt.Cipher()
ciph = c.caesar("Plaintext", 5)
print(ciph)
ciph_1 = c.caesar("ATTACKATONCE", 4)
print(ciph_1)
text = "Password"
shift = "Computer"
encoded_text = c.keyword_encode(shift)
hashtext = c.keyword(text, encoded_text)
print(hashtext)
if __name__ == "__main__":
main()