Generate two pairs of Merkle-Hellman Knapsack keys, with 2 different sizes. The size of pair one should be at least 5 and the size of pair 2 should be at least 6. Justify the selection of all selected numbers. [16 marks: 4 marks for correct private keys (2* 2 = 4); 2 marks for justifying the selected numbers; 10 marks for correct public key including correct calculation steps (5 * 2 = 10)]
Question
Generate two pairs of Merkle-Hellman Knapsack keys, with 2 different sizes. The size of pair one should be at least 5 and the size of pair 2 should be at least 6. Justify the selection of all selected numbers. [16 marks: 4 marks for correct private keys (2* 2 = 4); 2 marks for justifying the selected numbers; 10 marks for correct public key including correct calculation steps (5 * 2 = 10)]
Solution
The Merkle-Hellman Knapsack Cryptosystem is a public key cryptosystem based on the subset sum problem. It involves the creation of a 'hard' knapsack problem (the public key) from an 'easy' knapsack problem (the private key).
Here's how to generate two pairs of Merkle-Hellman Knapsack keys:
Pair 1 (size 5):
Step 1: Choose a superincreasing sequence (private key). A sequence is superincreasing if every element is greater than the sum of all previous elements. Let's choose (2, 3, 7, 14, 30).
Step 2: Choose a number n greater than the sum of the sequence, and a number m that is coprime with n. Let's choose n = 60 and m = 37.
Step 3: Calculate the public key by multiplying each element of the private key by m mod n. This gives us (74, 111, 57, 54, 30).
Pair 2 (size 6):
Step 1: Choose a superincreasing sequence (private key). Let's choose (2, 3, 7, 14, 30, 62).
Step 2: Choose a number n greater than the sum of the sequence, and a number m that is coprime with n. Let's choose n = 120 and m = 73.
Step 3: Calculate the public key by multiplying each element of the private key by m mod n. This gives us (146, 219, 121, 102, 90, 26).
Justification of selected numbers:
The private keys were chosen to be superincreasing sequences, as required by the Merkle-Hellman system. The numbers n were chosen to be greater than the sum of the private keys, and the numbers m were chosen to be coprime with n, also as required by the system. The public keys were then calculated according to the Merkle-Hellman system.
Similar Questions
Bob wants to create his own Merkle-Hellman Knapsack pair of keys. If the key size = 4 and his first element of the private key = 3. Show all the steps of creating the pair of keys.Answer text Question 2Rich text editor
Let's perform each step in detail to encrypt and decrypt the message "KIBIRANGO SAUL KKUBO" using the Merkle-Hellman Knapsack cryptosystem with the provided keys and values.Given Values:Private key: 𝑤=(2,3,7,15,29)w=(2,3,7,15,29)Modulus: 𝑀=59M=59Multiplier: 𝑁=17N=17Public key: 𝑏=(34,51,1,19,22)b=(34,51,1,19,22)
You are given an integer array nums and two integers cost1 and cost2. You are allowed to perform either of the following operations any number of times:Choose an index i from nums and increase nums[i] by 1 for a cost of cost1.Choose two different indices i, j, from nums and increase nums[i] and nums[j] by 1 for a cost of cost2.Return the minimum cost required to make all elements in the array equal.Since the answer may be very large, return it modulo 109 + 7. Example 1:Input: nums = [4,1], cost1 = 5, cost2 = 2Output: 15Explanation:The following operations can be performed to make the values equal:Increase nums[1] by 1 for a cost of 5. nums becomes [4,2].Increase nums[1] by 1 for a cost of 5. nums becomes [4,3].Increase nums[1] by 1 for a cost of 5. nums becomes [4,4].The total cost is 15.Example 2:Input: nums = [2,3,3,3,5], cost1 = 2, cost2 = 1Output: 6Explanation:The following operations can be performed to make the values equal:Increase nums[0] and nums[1] by 1 for a cost of 1. nums becomes [3,4,3,3,5].Increase nums[0] and nums[2] by 1 for a cost of 1. nums becomes [4,4,4,3,5].Increase nums[0] and nums[3] by 1 for a cost of 1. nums becomes [5,4,4,4,5].Increase nums[1] and nums[2] by 1 for a cost of 1. nums becomes [5,5,5,4,5].Increase nums[3] by 1 for a cost of 2. nums becomes [5,5,5,5,5].The total cost is 6.Example 3:Input: nums = [3,5,3], cost1 = 1, cost2 = 3Output: 4Explanation:The following operations can be performed to make the values equal:Increase nums[0] by 1 for a cost of 1. nums becomes [4,5,3].Increase nums[0] by 1 for a cost of 1. nums becomes [5,5,3].Increase nums[2] by 1 for a cost of 1. nums becomes [5,5,4].Increase nums[2] by 1 for a cost of 1. nums becomes [5,5,5].The total cost is 4. Constraints:1 <= nums.length <= 1051 <= nums[i] <= 1061 <= cost1 <= 1061 <= cost2 <= 106
Solve the following instance of greedy knapsack problem where n=4, m=10, p = (40, 42, 25,12) and w = (4, 7, 5, 3)
Given items as {value,weight} pairs {{40,20},{30,10},{20,5}}. The capacity of knapsack=20. Find the maximum value output assuming items to be divisible. Options 40 80 100 None of the mentioned
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.