I am trying to encrypt a password for my school project. Here is the process:Let's assume that I have a string p (n characters long) which contains the password.The program reverses the string and stores it in string r.It takes each character of p and r, applies the XOR operator and stores it in string e.Next time the user wants to access the file, 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.How many combinations it will take a computer to brute force it, in order to show if it is effective?The assignment prevents me from using any third-party libraries such as bcrypt.
Combinations of a password
passwords;combinatorics
No brute forcing is needed. Given the encrypted string e, I can produce a fake password p_ which your system will accept, very quickly.The algorithm to do this is:Let p_first_half be the first n/2 characters of e (where / indicates integer division, rounded down).Let p_ be p_first_half with n - n/2 zero-bytes appended.If you run p_ through your encryption algorithm, the result will be e, so your system will accept my fake password.