(1) Permutation Ciphers (a.k.a. Transposition Ciphers) are another class of simple cryptosystems. For this
we use the functions apply(.,.) and inv(.) from Homework 4; copy these two functions into your le as
auxiliary functions.
(1.a) De ne a function encr(k,m), where the message m is any string over the characters a…zA…Z, and
where the key k is a permutation. When len(m) is not a multiple of len(k) we append (a minimum number of)
Z’s to m to make len(m) a multiple of len(k). In the encryption, m is subdivided into successive chunks of length
len(k), and the permutation k is applied to each chunk. The number of chunks is ceil(len(m)/len(k)).
(1.b) De ne a decryption function decr(k,c), which inverts the encryption. Here, c is any string over the
characters a…zA…Z, such that len(c) is a multiple of len(k).
(1.c) As comments, answer the following:
Give the encryption of the following text, with key [3, 2, 4, 1, 0] :
‘SineLaboreNihil’
Decrypt the following cipher with the key [6, 1, 0, 2, 7, 4, 5, 3]:
EAGLSIALDOTMIISNPIVSAINAATREMUNM



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *