Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  ss
Language: C/C++
Code:
#include <iostream>
#include <string>

std::string decrypt(std::string obfuscatedEmail);

int main()
{
    std::cout << "Enter the obfuscated email address: ";
    std::string obfuscatedEmail;
    std::cin >> obfuscatedEmail;
    std::cout << decrypt(obfuscatedEmail) << std::endl;
}

std::string decrypt(std::string obfuscatedEmail)
{
    std::string output;
    char xorKey = std::stoi( obfuscatedEmail.substr(0, 2), nullptr, 16);
    for( unsigned i = 2; i < obfuscatedEmail.length(); i += 2)
        output += std::stoi( obfuscatedEmail.substr(i, 2), nullptr, 16) ^ xorKey;

    return output;
}
Comments: