程序代写 IP Addresses (ipv4)

IP Addresses (ipv4)
All computers on the Internet have unique addresses, which we call IP Addresses. These have traditionally been stored as 32-bit integers, but
that’s not easy for humans to remember, so instead, the 4 bytes of those 32-bit integers are cut up and each byte is displayed as a number 0-255
with each separated by a ‘.’. So, 127.0.0.1 ends up being a valid IP address (a special one too), but note that it could be converted into

Copyright By PowCoder代写 加微信 powcoder

2130706433. Note that you’ll need to write functions in Haskell that do this conversion in both directions.
Monoalphabetic Cipher
Encryption has been used for jumbling secret messages since ancient times. One simple algorithm that can be used is randomly assigning each
character another replacement character and storing all such replacements in a key, which would basically just be a single string that can be
used to do the conversion from plaintext to ciphertext (encryption) and then back from ciphertext to plaintext (decryption). The same key can be
used for both operations. Note that you’ll need to write functions in Haskell that will generate such a random key and do both encryption and
decryption of text.

Requirements
Define functions named and described as listed below. In addition, create a Haskell program that then demonstrates their use and tests them in
varied ways to verify that they work properly. You should use OnlineGDB to do your work. The functions you must define are as follows:
• numTolpAddress – this function should take in an integer and should create and return a string that displays the equivalent x.x.x.xIP
address representation of that number.
• ipAddressToNum – this function should take in a string in the format of x.x.x. representing a 32-bit ipv4 IP address and turn it into its
numeric equivalent as a single int, returning that value.
• generateKey – this function should take no input but will generate a randomly ordered string of all the capital letters. This means it should
have a length of precisely 26. It should then return that string. Note that this key could then be used for both encryption and decryption.
Also note that it is up to you how to map the letters and numbers to indices. Meaning, in the key, the character found at index 0 should be
replaced for what other character? That is up to you and how you use it in your encrypt and decrypt methods.
encrypt – this function should take a key string argument (like one produced by generateKey) and plaintext to encrypt. It should then return
the produced ciphertext.
• decrypt – this function should take as a key string argument (like one produced by generateKey) and ciphertext to decrypt. It should then
return the produced plaintext. Note that you should demonstrate your code working by combining use of both encrypt and decrypt using
the same keys.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com