I am a part of a programming class in college and we are working on Python. In one of our programming assignments I was tasked to create a password checking program that checks the password to see if it met the requirements. The whole program I was able to create but was just stuck on this one function. The function that I could not get was a function that is supposed to encrypt a password with the requirements shown below if the password met previous requirements.
Encryption algorithm is based on corresponding ASCII values of different characters in the valid password. For each character in the password,
-add +1 if it is alphanumeric. For example, if the character is a uppercase letter, lower case letter, or a digit: encryptedCharacter = character + 1
-add -1 if it is one of the four special characters. if the character is one of these four characters ! @ # $: encryptedCharacter = character - 1
Above is the type of algorithm requirements for the assignment. Since my program is so large already, I was going to work on this function (encrypt(password) in a separate file before putting it in to the whole program.
To sum it up, "password" is a string that needs the special encryption done. Very lost on this and would really appreciate it if some experience Python Programmers will give me some pointers on where to start. (Did not show any code here because I simply did not no where to start.)(If you would like, I guess I can show the rest of the program although its only one function that I am having trouble with)
Thanks in advance everyone.