Challenge 49

🔐

File Encrypter / Ransomware

Open in Code Editor or Copy Instructions

As with many things, they can be used for both good and bad - one such example is file encryption

While file encryption can be used to maintain privacy/increase security to making data unintelligible to malicious actors, file encryption can also be used by malicious parties in the form of e.g. ransomware

Your task is to use either the Caesar, substitution or your own cipher to encrypt and also decrypt files

A user should be shown a menu asking them if they want to encrypt or decrypt. They would then be prompted for the filename and the process will complete. For some ciphers, they might be required to enter a key/password (as in the shift amount, for the Caesar cipher)...while for the substitution cipher, the mapping could be stored as an array, even saved to a file etc

Examples:

Program prompts "Choose 'e' to encrypt or 'd' to decrypt a file: " and user enters "e"

Program prompts "Enter name of file to encrypt: " and user enters "important.txt"

If user manually checks this file now, it should be encrypted

The user will now be prompted with the original menu, where they can choose what to do next

Extension:

For both legitimate and malicious file encryption programs, they will often scan the computer looking for files - simulate this by having an array of e.g. 3 file names, then encrypting/decryption all of them in one go