Question

In: Computer Science

asap please python Using block diagram, design the architectural layout of the simplified model of a...

  1. asap please python
    1. Using block diagram, design the architectural layout of the simplified model of a symmetric Cryptosystem.
    2. Implement a cryptosystem columnar transposition technique with a 4 x 4 matrix arrangement. Test your code with ‘cryptography’ as the plaintext.

Solutions

Expert Solution

Answer I)

It is a technique used to avoid an unauthorized access of data. It helps to provide accountability fairness and accuracy and also provide confidentiality. Broadly, four different kinds of people contributed their efforts in this technique and are: (i) Military, (ii) The Diplomatic Corps, (iii) Diarists, and (iv) Communications System. Cryptography involves two basic operations and is named as encryption and key management. Information/data canbe encrypted using a cryptographic algorithm by various keys. The security of cryptographic system is not only
dependent on the encryption algorithm; it also depends upon the keys used for the encryption. These keys area always kept secured from the hacker and are known as secret key. Key plays an important role in encryption process, which is a main part of cryptography . Due to channel impairments sometimes the transmitted data and/or key may get corrupted. If it is slightly changed or corrupted, the data will not be recovered; therefore, key needs to be transported over the secured channel. The frequency of use of a cryptographic key always has a direct correlation to how often the key should be changed. Encryption algorithms can be hacked by utilizing supercomputer which provides fast speed and allows the hacker to use more permutations and combinations in a specified time. Modern era depends upon wireless communication and almost all the electronic funds are being carried out online. In order to protect the same and maintain the privacy of the users; cryptography is the best solution due to their better response even in the presence of advisory. For better security, either more number of keys is used or the length of the existing keys is increased. In both the approaches the overheads are increased, therefore, the best idea is to use sub-keys. Sub-keys are used only for such nodes which are attacked by the hacker. The sub keys are always derived from the main key which helps in reducing the overheads. The basic cryptographic model has been shown in figure 2.1. It involves encryption and decryption section; initially, the data has been encrypted by the help of key and further transmitted over the web. Finally, it has been received and the encrypted data is decrypted with the help of same or different key. The key is any value and/or word and is used in both the sections for encryption and decryption purpose.

Answer II)

# Python3 implementation of

# Columnar Transposition

import math

key = "HACK"

# Encryption

def encryptMessage(msg):

    cipher = ""

    # track key indices

    k_indx = 0

    msg_len = float(len(msg))

    msg_lst = list(msg)

    key_lst = sorted(list(key))

    # calculate column of the matrix

    col = len(key)

     

    # calculate maximum row of the matrix

    row = int(math.ceil(msg_len / col))

    # add the padding character '_' in empty

    # the empty cell of the matix

    fill_null = int((row * col) - msg_len)

    msg_lst.extend('_' * fill_null)

    # create Matrix and insert message and

    # padding characters row-wise

    matrix = [msg_lst[i: i + col]

              for i in range(0, len(msg_lst), col)]

    # read matrix column-wise using key

    for _ in range(col):

        curr_idx = key.index(key_lst[k_indx])

        cipher += ''.join([row[curr_idx] for row in matrix])

        k_indx += 1

    return cipher

# Decryption

def decryptMessage(cipher):

    msg = ""

    # track key indices

    k_indx = 0

    # track msg indices

    msg_indx = 0

    msg_len = float(len(cipher))

    msg_lst = list(cipher)

    # calculate column of the matrix

    col = len(key)

     

    # calculate maximum row of the matrix

    row = int(math.ceil(msg_len / col))

    # convert key into list and sort

    # alphabetically so we can access

    # each character by its alphabetical position.

    key_lst = sorted(list(key))

    # create an empty matrix to

    # store deciphered message

    dec_cipher = []

    for _ in range(row):

        dec_cipher += [[None] * col]

    # Arrange the matrix column wise according

    # to permutation order by adding into new matrix

    for _ in range(col):

        curr_idx = key.index(key_lst[k_indx])

        for j in range(row):

            dec_cipher[j][curr_idx] = msg_lst[msg_indx]

            msg_indx += 1

        k_indx += 1

    # convert decrypted msg matrix into a string

    try:

        msg = ''.join(sum(dec_cipher, []))

    except TypeError:

        raise TypeError("This program cannot","handle repeating words.")

    null_count = msg.count('_')

    if null_count > 0:

        return msg[: -null_count]

    return msg

# Driver Code

msg = "Geeks for Geeks"

cipher = encryptMessage(msg)

print("Encrypted Message: {}". format(cipher))

print("Decryped Message: {}". format(decryptMessage(cipher)))

Output:

Encrypted Message: e  kefGsGsrekoe_
Decrypted Message: Geeks for Geeks

Note: Plzzz don' t give dislike.....Plzzz comment if u have any problem i will try to resolve it.......


Related Solutions

Using block diagram, design the architectural layout of the simplified model of a symmetric Cryptosystem. Implement...
Using block diagram, design the architectural layout of the simplified model of a symmetric Cryptosystem. Implement a cryptosystem columnar transposition technique with a 4 x 4 matrix arrangement. Test your code with ‘cryptography’ as the plaintext. prefer python but it doesn't matter.
DUE IN TWO HOURS ASAP PLEASE!!! Given the following specification, design a class diagram using PlantUML....
DUE IN TWO HOURS ASAP PLEASE!!! Given the following specification, design a class diagram using PlantUML. To design the class diagram, use abstract (10 points), static (10 points), package (20 points ), namespace (20 points ), association (20 points ), and generalization (20 points ) on PlantUML Specification: A school has a principal, many students, and many teachers. Each of these persons has a name, birthdate, and may borrow and return books. The book class must contain a title, abstract,...
Choosing the best architectural style draw an architectural diagram for the following scenarios using MS Visio:...
Choosing the best architectural style draw an architectural diagram for the following scenarios using MS Visio: A vending machine used by passengers at a railway station. A-Zoom application conferencing system that allows video, audio, and computer data to be visible to several participants at the same time.
Using the simplified one-period model explain in words and illustrate via a diagram how moving from...
Using the simplified one-period model explain in words and illustrate via a diagram how moving from a proportional tax to a lump sum tax would increase consumer welfare. Explain why the lump sum tax is more efficient.
Instruction to assigned to each processor. ARM Cortex-A12 Draw neatly architectural or block diagram of the...
Instruction to assigned to each processor. ARM Cortex-A12 Draw neatly architectural or block diagram of the selected processor. Identify the following listed below features and explain briefly. Pipelining and stages Memory or Cache Fetch Unit and Decode units Instruction issue policy Register Renaming Reorder Buffer Reservation Station Branch Prediction Execution Units Processor speed Number of Cores Number of Threads 36 Levels of cache and separate or shared cache or instruction and data cache Hyper-Threading or TLP
Please answer all a.Describe the Simplified Circular Flow Model. b.Explain how the Simplified Circular Flow Model...
Please answer all a.Describe the Simplified Circular Flow Model. b.Explain how the Simplified Circular Flow Model applies to your life.
Given the following specification, design a class diagram using PlantUML. To design the class diagram, use...
Given the following specification, design a class diagram using PlantUML. To design the class diagram, use abstract, static, package, namespace, association, and generalization on PlantUML Specification: A school has a principal, many students, and many teachers. Each of these persons has a name, birth date, and may borrow and return books. The book class must contain a title, abstract, and when it is available. Teachers and the principal are both paid a salary. A school has many playgrounds and rooms....
According to the perspective of QPSK digital signal processing, design a block diagram for the given...
According to the perspective of QPSK digital signal processing, design a block diagram for the given diagram below and explain for the given diagram (how does the signal go through the given diagram). The following figure is a  homodyne detection for coherent optical fiber communications . Once is the signal from laser and the other one is the local oscillator. After the QPSK demodulation, the electric field E will go through the photo diode detection. (you dont have to consider the...
Design bcd adder diagram using 7486
Design bcd adder diagram using 7486
Problem 8 ( please write neatly and in full ) a) Draw the block diagram with...
Problem 8 ( please write neatly and in full ) a) Draw the block diagram with feed-forward. What are its advantages? b) Why are limiters used and what are their effects? c) What is the integrator windup and how can it be avoided?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT