DWITE Online Computer Programming Contest, March 2010, Problem 5
In secure authentication, one does not necessarily need to provide their password, they just need to prove that they know their own password. The subtle difference allows one to store just an encoded hash of a password. That way the actual (plaintext) password is never stored, making the system more secure, as the real password is never written down and can't be stolen, should a system be compromised…
The input will contain 5 lines, integers the hash stored in place of the password.
The output will contain 5 lines, each a 4 character long password that generate the corresponding input hashes.
Assume that all passwords are four characters long and are made up of capital letters only.
A hash is calculated as follows. Given a password , made up of four letters ; each letter is turned into its ASCII value, where and — . Let . Let . Then .
For example: given a password , there are four letters , , , ; and mapped to ASCII , , , . Then . And . So .
Note: Be aware of time constraints. Also, there are cases where multiple passwords result in the same hash. Those hashes are not a part of the test cases.
Sample Input
670281
603131
464132
Sample Output
TONY
DWTE
PASS
Problem Resource: DWITE
Comments