generator: rm using directives,use CryptoPP prefix
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e7cce999a0
commit
8827582f90
|
@ -75,12 +75,6 @@ auto Generator::do_crypto() -> std::string {
|
||||||
|
|
||||||
// for the moment loosely based on
|
// for the moment loosely based on
|
||||||
// https://www.cryptopp.com/wiki/CTR_Mode
|
// https://www.cryptopp.com/wiki/CTR_Mode
|
||||||
using CryptoPP::StringSource;
|
|
||||||
using CryptoPP::StringSink;
|
|
||||||
using CryptoPP::HexEncoder;
|
|
||||||
using CryptoPP::StreamTransformationFilter;
|
|
||||||
using CryptoPP::Serpent;
|
|
||||||
using CryptoPP::CTR_Mode;
|
|
||||||
|
|
||||||
// William Shakespeare, Romeo and Juliet
|
// William Shakespeare, Romeo and Juliet
|
||||||
std::string plain{"Oh, I am fortune's fool!"};
|
std::string plain{"Oh, I am fortune's fool!"};
|
||||||
|
@ -93,7 +87,7 @@ auto Generator::do_crypto() -> std::string {
|
||||||
std::memmove(ctr, str_ctr.c_str(), ctr_length);
|
std::memmove(ctr, str_ctr.c_str(), ctr_length);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CTR_Mode<Serpent>::Encryption e;
|
CryptoPP::CTR_Mode<CryptoPP::Serpent>::Encryption e;
|
||||||
e.SetKeyWithIV(G.k,G.k.size(),ctr);
|
e.SetKeyWithIV(G.k,G.k.size(),ctr);
|
||||||
|
|
||||||
// The StreamTransformationFilter adds padding as required. ECB and
|
// The StreamTransformationFilter adds padding as required. ECB and
|
||||||
|
@ -101,9 +95,9 @@ auto Generator::do_crypto() -> std::string {
|
||||||
// mode not.
|
// mode not.
|
||||||
// the "true" param - pump all of the data immediately to its
|
// the "true" param - pump all of the data immediately to its
|
||||||
// attached transformation
|
// attached transformation
|
||||||
StringSource str_src1(plain,true,
|
CryptoPP::StringSource str_src1(plain,true,
|
||||||
new StreamTransformationFilter(e,
|
new CryptoPP::StreamTransformationFilter(e,
|
||||||
new StringSink(cipher)
|
new CryptoPP::StringSink(cipher)
|
||||||
) // StreamTransformationFilter
|
) // StreamTransformationFilter
|
||||||
); // StringSource
|
); // StringSource
|
||||||
}
|
}
|
||||||
|
@ -113,9 +107,9 @@ auto Generator::do_crypto() -> std::string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pretty print cipher text
|
// Pretty print cipher text
|
||||||
StringSource str_src2(cipher,true,
|
CryptoPP::StringSource str_src2(cipher,true,
|
||||||
new HexEncoder(
|
new CryptoPP::HexEncoder(
|
||||||
new StringSink(encoded_c)
|
new CryptoPP::StringSink(encoded_c)
|
||||||
) // HexEncoder
|
) // HexEncoder
|
||||||
); // StringSource
|
); // StringSource
|
||||||
|
|
||||||
|
|
Reference in New Issue