C/C#/Java/Python/MATLAB 语言辅导、Encryption/Decryption Algorithms 代码辅导讲解辅导留学生
- 首页 >> C/C++编程Information Systems Security and Protection
Beijing Jiao Tong University
Homework 2 (10% of final grade)
Coding for Encryption/Decryption Algorithms
Submission Deadline: 23:59:59, Sept 28.
You can write in C/C#/Java/Python/MATLAB, etc.
1. Substitution Ciphers
In Substitution cipher, each letter in the plaintext is replaced by a letter having some fixed
number of positions down/or up the alphabet.
• Example:
Please implement Encrypt(Letter, Key) and Decrypt(Letter, Key). Key is the input
parameter, which can be defined by users. For example, when Key=3,
Encrypt(“HELLO”,3) = “KHOOR”, and Decrypt(“KHOOR”,3) = “HELLO”. Key can be
other values.
2. Transposition Cipher
In transposition cipher, the message is encrypted by rearranging the letter order, i.e., write
letters out diagonally over a number of rows, then read off cipher row by row. For
example, the plain text “meet after the toga party”, can be written out as:
• m e m a t r h t g p r y
• e t e f e t e o a a t
if the cipher text is written in two rows.
Please implement Encrypt(Letter, Key) and Decrypt(Letter, Key), with Key as how many
rows are there in cipher text.
3. Product Ciphers
2
We define Product Cipher as the Function of Boolean algebra: two bits are compared. If
two bits are identical, the result is binary 0; If two bits are not identical, the result is
binary 1, shown as in the following figure.
Please implement Encrypt(Letter, Key) and Decrypt(Letter, Key), with Key as defined by
users.
Submission:
Zip all C codes, submit it to Class Representative before deadline.