the python code for hill cipher is as follows
import numpy as np from numpy.linalg import inv originalMessage = [] encryptKey = [] def get_user_input(value, msg): input = raw_input(msg) input = input.lower() for character in input: number = ord(character) - 96 value.append(number) get_user_input(originalMessage, 'Enter Message to Encrypt') get_user_input(encryptKey, 'Enter decryption Key') # Get the length of input inputLen = len(originalMessage) ceilInt = np.int(np.ceil(np.sqrt(inputLen)))**2 # Modulo, this is our n in nXn modHelper = np.sqrt(ceilInt) rows, cols = np.int(modHelper), np.int(modHelper) # Create our empty matrix and fill it with our values def build_matrix(matrix): # Create matrix value = np.zeros(shape=(rows, cols)) # Append our values for (i, v) in zip(range(0, len(matrix)), matrix): r, c = i / cols, i % cols value[r, c] = v return value originalMessage = build_matrix(originalMessage) encryptKey = build_matrix(encryptKey) # Multiply our message by our encrypt key encryptedMessage = np.dot(originalMessage, encryptKey) print(encryptedMessage) # Inverse the encryption key for awesomeness decryptionKey = inv(np.matrix(encryptKey)) print(decryptionKey) # Our decrypted matrix is decryptedMessage = np.dot(originalMessage, decryptionKey) print(decryptedMessage)
you can execute it by running these in the jupyter notebook till spaces in each cell.
remember to run in order to get the perfect output of the cipher
Exercise: Execute the next cell to produce a message encrypted using the Hill cipher method [4]: ...
1. Forecast demand for Year 4. a. Explain what technique you utilized to forecast your demand. b. Explain why you chose this technique over others. Year 3 Year 1 Year 2 Actual Actual Actual Forecast Forecast Forecast Demand Demand Demand Week 1 52 57 63 55 66 77 Week 2 49 58 68 69 75 65 Week 3 47 50 58 65 80 74 Week 4 60 53 58 55 78 67 57 Week 5 49 57 64 76 77...
Use the moving average method to forecast period 105.Use the exponential smoothing method to forecast period 105.Use the time-series decomposition method to forecast period 105.Comparing the three methods, which one fits this situation best?The larger the parameter (n) is set, the more historical data are taken into account by the moving average.You can choose different parameter (n) to extrapolate to compare the prediction effect.In general, the parameter (n) should not be taken too large.Moving average.153025703560453055106560761085609580106101165012700136701470015760167301776018820197802090021840227702382024800257602676027770287902976030740317203267033690344703567036690376203865039610406204164042590436104460045630466004763048640496105059051610526305366054640558105679057820586505971060700616706269063730647306576066790678106887069890708707189072880739307498075900768607789078880798708084081860829108387084860858408654087780887508978090760917109273093750947509571096750977209877099740100750101760102780103800104850105Exponential smoothingsame153025703560453055106560761085609580106101165012700136701470015760167301776018820197802090021840227702382024800257602676027770287902976030740317203267033690344703567036690376203865039610406204164042590436104460045630466004763048640496105059051610526305366054640558105679057820586505971060700616706269063730647306576066790678106887069890708707189072880739307498075900768607789078880798708084081860829108387084860858408654087780887508978090760917109273093750947509571096750977209877099740100750101760102780103800104850105Time-series decomposition153025703560453055106560761085609580106101165012700136701470015760167301776018820197802090021840227702382024800257602676027770287902976030740317203267033690344703567036690376203865039610406204164042590436104460045630466004763048640496105059051610526305366054640558105679057820586505971060700616706269063730647306576066790678106887069890708707189072880739307498075900768607789078880798708084081860829108387084860858408654087780887508978090760917109273093750947509571096750977209877099740100750101760102780103800104850105
IN JAVA PLEASE!!! :) Multithreading can help in achieving parallelism in computational problems. This makes the program’s response to generate output faster. It is achieved by delegating independent tasks within the program to separate threads instead of creating a sequential routine. Consider the following sample double array: 3 11 5 19 1 8 4 16 7 18 17 6 3 23 9 If the problem is to display all the row-sums and all the column-sums, a sequential program would use...
Infinite Spiral of Numbers (due 17 Feb 2020) HELLO, WE ARE USING PYTHON 3 TO COMPLETE THIS PROJECT!! PLEASE FOLLOW CODE SKELETON AS GIVEN AT THE END. THIS IS DUE 17TH FEB 2020, ANY AND ALL HELP WOULD BE GREATLY APPRECIATED, THANK YOU! Consider the natural numbers laid out in a square spiral, with 1 occupying the center of the spiral. The central 11 x 11 subset of that spiral is shown in the table below. 111 112 113 114...
python program do not use dictionary, list only Complete the program found in assignment4.py. You may not change any provided code. You may only complete the sections labeled: #YOUR CODE HERE Write a program that does the following. Reads the contents of Text from the include file, input.txt Create a dictionary of key-value pairs called index.txt Key: This represents the individual word Value: This is a list of the line number from Text where Key appeared Example: If the word...
Reporting Adjusted Account Balances using Excel's SUM, Basic Math Functions and Cell Referencing Maple Moving Company has provided a list of its account balances as of December 31, 2016 before year-end adjustments. The Controller has also provided you with a list of year end data to determine the adjusted account balances and has asked you to prepare the adjusted trial balance. Use the information included in the Excel Simulation and the Excel functions described below to complete the task. Cell...
2 62.8 MEAN = 3 71.9 MEDIAN = 4 69.6 MODE= 5 74.1 RANGE = 6 66.6 MIN. = 7 76.5 MAX.= 8 66.4 STDEV. = 9 73.1 MY HEIGHT =67.00 10 71.6 Z SCORE FOR MY HEIGHT = 11 69.3 12 64.0 13 70.9 14 62.2 15 63.3 16 67.7 17 65.2 18 64.2 19 69.4 20 71.7 21 64.6 22 69.0 23 71.3 24 69.1 25 71.6 26 75.9 27 66.2 28 67.4 29 64.6 30 69.6 31...
Write the C program, to achieve as shown in the sample code execution, using the given struct and using the comments in the given main program below: typedef struct{ char first[20]; char last[20]; float gpa; int score; } student; int main(void){ student *ptr; //first name //last name //student gpa //student score } //ask a user to enter the number of students, num //dynamically allocate memory for an array of students of the appropriate size (i.e. //num that the user just...
The task involves writing a C++ program that determines the prime numbers between 1 and 100. The steps you should follow to identify the prime numbers are the following. 1. The number 1 is not a prime number, so it should be scratched. 2. Starting from the first prime number, which is 2, you scratch all the numbers that are the multiple of 2. You should not scratch out 2 itself. 3. The next number in the sequence after the...
== Programming Assignment == For this assignment you will write a program that controls a set of rovers and sends them commands to navigate on the Martian surface where they take samples. Each rover performs several missions and each mission follows the same sequence: deploy, perform one or more moves and scans, then return to base and report the results. While on a mission each rover needs to remember the scan results, in the same order as they were taken,...