Number of combinations of combinations A=0100 0001,
B=0100 0010,
X=A^B=0000 0011.
If I have X only, is it possible to obtain A and B? How many combinations it will take a computer to find the correct values, if A and B can have all characters of values between ASCII 32 and ASCII 126 (i.e it can have lowercase, uppercase,symbols and numbers and space)? ('^' is XOR operator)
What I am doing:I am trying to encrypt a password in a program for my school project. Here is the process: Let us assume that I have a string p(n characters long)which contains the password. Now the program reverse the string and stores it in string r.After that it takes each character of p and r applies the XOR operator and stores it in string e.Next time the user want to access the file he/she will be asked to enter the password. The entered password will go through the process explained above and will be compared to string e. If both are not equal access will be denied.I want to know the number of combinations required for the brute force attack.
 A: It sounds like what you want is a hash-function. You want a way to authenticate a password without storing the actual password and comparing to that. In the procedure you described it is correct that we can have $95^n$ passwords $p$ of length $n$. This does not imply that your procedure can output $95^n$ different hash values $e$. 
It might be the case that different pairs of ASCII-characters in the given range yield the same $\operatorname{XOR}$-value. You can create a $95\times 95$ table to check this:
$$
\begin{array}{|c|c|}
\hline
\operatorname{XOR}&32&33&...&126\\
\hline
32&&&&\\
\hline
33&&&&\\
\hline
\vdots&&&&\\
\hline
126&&&&\\
\hline
\end{array}
$$
If two entries in this table, say $(A,B)$ and $(C,D)$, coincide, one could interchange letters $A,B$ found in symmetrical positions from each end in $p$ by $C,D$ and nobody would notice.
For one thing, one can always swap $A,B$ at positions $i,n-i$ of $p$ and still have the same hash value of $p$. So the number of passwords yielding a given hash value $e$ can be huge. For instance if $p$ has length $10$ and consists of pairwise distinct characters at positions $i,n-i$, then you can swap any pair at positions $i,n-i$ of $p$ to have another password with the same hash value $e$. This gives at least $2^5=32$ such passwords for that case.
One other problem is that the length of $e$ reveals the length of $p$, so someone gaining access to the file with hashed passwords can at least learn the length of those passwords from that file.
Finally, it makes no sense to me that you call it an encryption of the passwords. How would one decrypt $e$?
