Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6932513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:42:56+00:00 2026-05-27T11:42:56+00:00

What is a simple and effective way to encrypt a plain text file? I’m

  • 0

What is a simple and effective way to encrypt a plain text file? I’m not looking for safety, I just want the average user not to be able to tamper with it. Say I have a file with newline separated email addresses. I want it to look like a garbled mess when opened, but easy to decrypt.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:42:57+00:00Added an answer on May 27, 2026 at 11:42 am

    The simplest practical form is an XOR cipher. Basically you generate an encryption/decryption key of random numbers, of any length. To encrypt or decrypt your data, XOR the data with the key.

    It is not very secure; it’s mostly just used to do a light obfuscation.

    #include <vector>
    
    typedef unsigned __int8 BYTE;
    
    std::vector<BYTE> xor_encryptdecrypt(const std::vector<BYTE>& encryptionKey, const std::vector<BYTE>& input)
    {
        std::vector<BYTE> ret;
        ret.reserve(input.size());
    
        std::vector<BYTE>::const_iterator keyIterator = encryptionKey.begin();
    
        for(std::vector<BYTE>::const_iterator inputIterator = input.begin(); inputIterator != input.end(); ++ inputIterator)
        {
            ret.push_back(*inputIterator ^ *keyIterator);
    
            // advance the key iterator, wrapping to begin.
            if(++ keyIterator == encryptionKey.end())
                keyIterator = encryptionKey.begin();
        }
        return ret;
    }
    
    
    int main()
    {
        // variable-length key of randomness, used for both encryption and decryption.
        std::vector<BYTE> key;
        key.push_back(0x55);
        key.push_back(0xae);
        key.push_back(0x8c);
        key.push_back(0x14);
    
        std::vector<BYTE> input;
        input.push_back(0x00);
        input.push_back(0x01);
        input.push_back(0x02);
        input.push_back(0x03);
        input.push_back(0x04);
        input.push_back(0x05);
    
        // encrypt
        std::vector<BYTE> encrypted = xor_encryptdecrypt(key, input);
    
        // decrypt
        std::vector<BYTE> decrypted = xor_encryptdecrypt(key, encrypted);
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for easy steps that are simple and effective in making a
I was wondering what would be a simple and effective way to trigger a
Simply put: What is the most effective way to share / reuse code between
For a web application, I would like to create a simple but effective licensing
Which method is very effective and simple to code to attain this functionality ?
What's the cleanest, most effective way to validate decimal numbers in JavaScript? Bonus points
The only socket programming I have done in the past is simple text streams.
I've just started looking into Amazon's DynamoDB. Obviously the scalability appeals, but I'm trying
Using SQL Server, what is a simple but effective means of denying access to
I can't have the same key. But a simple (and effective) solution is put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.