Cipher decrypt example
 
 
#include "string/encoding.h"
 
#include <iostream>
 
int main(int argc, char** argv)
{
 
    
    std::cout << "Password: " << password << std::endl;
 
    
    std::string salt = (argc > 2) ? argv[2] : "12345678";
    std::cout << "Salt: " << salt << std::endl;
 
    
    std::cout << 
"Cipher name: " << cipher.
name() << std::endl;
 
    std::cout << 
"Cipher iterations: " << cipher.
iterations() << std::endl;
 
 
    std::cout << "Please enter strings to decrypt. Enter '0' to exit..." << std::endl;
 
    
    std::string line;
    while (getline(std::cin, line))
    {
        if (line.empty() || (line == "0"))
            break;
 
        std::string decoded = CppCommon::Encoding::Base64Decode(line);
        std::string decrypted = cipher.
Decrypt(decoded);
 
 
        
        std::cout << decrypted << std::endl;
    }
 
    return 0;
}
void Initialize(std::string_view secret)
Initialize the cipher with the given secret key.
 
const std::string & name() const noexcept
Get the cipher algorithm name.
 
size_t iterations() const noexcept
Get the count of key hashing iterations.
 
std::string Decrypt(std::string_view str)
Decrypt the given string.