BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

Matlab代写 | Maths 162 Assignment 2: MATLAB and Cryptography

Matlab代写 | Maths 162 Assignment 2: MATLAB and Cryptography

这个作业是用Matlab完成加密解密的程序

Maths 162 Assignment 2: MATLAB and Cryptography

1. A one time pad (see 2.8 in your coursebook) is the following method for encrypting information.
Ahead of time, have the parties that want to communicate securely exchange a code
book, which consists of an arbitrarily long sequence of letters.
If one of these parties wants to encrypt a message M of length n, they go to their
codebook, and take a section C of n characters from the start of their book.
They then go through their message M, and replace each character M(1), M(2), M(3),…
with the characters M(1)+C(1) (mod 26), M(2)+C(2) (mod 26), M(3)+C(3) (mod 26),…
using the standard {a, b . . . z} ! {0, 1,… 25} correspondence. In other words, they “add”
each character of M to the corresponding character in C mod 26.
To decrypt an encrypted message E, they do the same thing but in reverse; i.e. they replace each character E(1), E(2),… with E(1)C(1) (mod 26), E(2)C(2) (mod 26),….
In other words, they take E and “subtract” C letter-by-letter.
1
For example, let’s suppose that we wanted to send the 9-character message “I am hungry” (ignoring spaces/etc), and the codebook we agreed to share was this blogpost with an (excellent!)
recipe for hazelnut brown butter cake. Because the first 9 characters (ignoring spaces/etc) of
the recipe blog are “LAST MONTH”, we’d encrypt this as follows:
I AM HUNGRY
+ ++ ++++++
L AS TMONTH
= == ======
T AE AGBTKF
!
!
!
08 00 12 07 20 13 06 17 24
+ ++ ++++++
11 00 18 19 12 14 13 19 07
======= ==== ======== === =====
19 00 04 00 06 01 19 10 05

bestdaixie