FOCP-Assignment 2
FOCP-Assignment 2
• High-Level Design:
o Identify the primary modules (e.g., text input, encryption, frequency analysis,
decryption).
o List programming constructs like loops, arrays, conditionals, functions, and basic
file I/O if applicable.
o Create flowcharts to represent the encryption and decryption processes, from
input to frequency analysis and decryption output.
o Define main functions and their roles: encryptText(), frequencyAnalysis(),
decryptText(), and compareResults().
• Data Design: Choose appropriate data types to store your data.
• Algorithm Design:
o Implement a Frequency Analysis Algorithm to count occurrences of each letter in
the cipher text.
1|Page
FOCP-Assignment 2
o Build a substitution key based on frequency data and common English letter
distributions to decrypt the cipher text.
Implementation Requirements:
• Input:
o Prompt the user to enter a plain text message for encryption.
o Allow the user to choose an encryption method from any two (if two group
members)/three (if three group members) options, such as Caesar Cipher, Atbash
Cipher, or Monoalphabetic Substitution Cipher.
o Ensure input validation for alphabetic text only (no numbers or symbols).
• Encryption:
o Encrypt the text using the chosen cipher. Output the encrypted message to show the
result.
• Frequency Analysis Alf=gorht:
o Perform frequency analysis on the encrypted message to calculate the most common
letters.
o Using frequency data, generate a probable substitution key and attempt to decrypt
the text.
o Output the decrypted message and compare it to the original input to assess accuracy.
• Error Handling: Include error handling for invalid input and cases where decryption may not
fully match the original text.
• Modularity: Design the program with modularity in mind. Break down the code into functions
to promote reusability and maintainability. Organize the code with modular functions like
encryptText(), frequencyAnalysis(), decryptText(), and outputResults().
• Code Style and Best Practices: Follow C++ coding standards with meaningful variable names,
indentation, and comments.
• Testing and Validation: Develop a testing plan to validate encryption and decryption results,
including a variety of inputs and ciphers.
Document Requirements:
Write a brief report explaining the encryption and decryption processes, frequency analysis, and
testing results.
Include code snippets, screenshots of encryption and decryption output, and documentation for
each function. Demo and viva will be conducted in the lab.
Submission Criteria:
2|Page
FOCP-Assignment 2
3|Page
FOCP-Assignment 2
4|Page