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 8920705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:20:42+00:00 2026-06-15T06:20:42+00:00

I am trying to XOR some already encrypted files. I know that the XOR

  • 0

I am trying to XOR some already encrypted files.
I know that the XOR key is 0x14 or dec(20).

My code works except for one thing. All the ‘4’ is gone.

Here is my function for the XOR:

void xor(string &nString)    // Time to undo what we did from above :D
{
   const int KEY = 0x14;
   int strLen = (nString.length());
   char *cString = (char*)(nString.c_str());

   for (int i = 0; i < strLen; i++)
   {
    *(cString+i) = (*(cString+i) ^ KEY);
   }
}

Here is part of my main:

ifstream inFile;
inFile.open("ExpTable.bin");
if (!inFile) {
    cout << "Unable to open file";
}

string data;                                 

while (inFile >> data) {
    xor(data);
    cout << data << endl;
}

inFile.close();

Here is a part of the encypted file:

$y{bq      //0 move
%c|{       //1 who
&c|qfq     //2 where 
'saufp     //3 guard
 x{wu`}{z  //4 location

But x{wu}{z` is returning //location. Its not displaying the 4.
Note the space infront of the X. thats supposed to be decoded to 4.

What am I missing? Why is it not showing all the 4? <space> = 4 // 4 = <space>


UPDATE

This is the list of all the specific conversions:

HEX(enc) ASCII(dec)
20       4                  
21       5                  
22       6                  
23       7                  
24       0                  
25       1                  
26       2                  
27       3                  
28       <                  
29       =                  
2a       >                  
2b       ?                  
2c       8                  
2d       9                  
2e       :                  
2f       ;                  
30       $
31       %
32       &
33       '
34       
35       !
36       "
37       #
38       ,
39       -
3a       .
3b       /
3c       (
3d       )
3e       *
3f       +
40       T
41       U
42       V
43       W
44       P
45       Q
46       R
47       S
48       \
49       ]
4a       ^
4b       _
4c       X
4d       Y
4e       Z
4f       [
50       D
51       E
52       F
53       G
54       @
55       A
56       B
57       C
58       L
59       M
5a       N
5b       O
5c       H
5d       I
5e       J
5f       K
60       t
61       u
62       v
63       w
64       p
65       q
66       r
67       s
68       |
69       }
6a       
6b       
6c       x
6d       y
6e       z
6f       {
70       d
71       e
72       f
73       g

75       a
76       b
77       c
78       l
79       m
7a       n
7b       o
7c       h
7d       i
7e       j
7f       k
1d       /tab
1e       /newline
  • 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-06-15T06:20:43+00:00Added an answer on June 15, 2026 at 6:20 am
    1. Get rid of all casts.
    2. Don’t use >> for input.

    That should fix your problems.

    Edit:

    // got bored, wrote some (untested) code
    ifstream inFile;
    inFile.open("ExpTable.bin", in | binary);
    if (!inFile) {
        cerr << "Unable to open ExpTable.bin: " << strerror(errno) << "\n";
        exit(EXIT_FAILURE);
    }
    
    char c;
    while (inFile.get(c)) {
        cout.put(c ^ '\x14');
    }
    
    inFile.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get some code that will perform a perspective transformation (in this
I'm trying to find a very efficient way to encrypt files. One way that
Hi I'm trying to write some assembly code that uses printf to print a
I am trying to XOR two bitmap files (their byte arrays) to produce a
I've been trying to make a basic XOR header file for use in some
I'm trying to open an encrypted file that will store a list of information,
I'm trying to code some hibernate examples, and I've found this : AnnotationConfiguration config
I'm trying to XOR binary values but for some unknown reason I'm losing the
Can some one help me with reversing of _PrepareMenuWindow() subroutine? I am trying to
I'm trying to port some Java code, which requires arithmetic and logical bit shifts,

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.