Public Key Algorithm Is Also Known As Asymmetric Algorithms Different Keys For Encryption and Decryption
Public Key Algorithm Is Also Known As Asymmetric Algorithms Different Keys For Encryption and Decryption
2
Knapsack Algorithms
3
Knapsack Problem
4
Knapsack Algorithm Basic
A block of plaintext equal in length to the number of
items in the pile would select the items in the
knapsack
⚫ plaintext bits corresponding to the b values, and
⚫ the ciphertext would be the resulting sum.
There are actually two different knapsack problems,
⚫ one solvable in linear time (easy) and
⚫ the other believed to be (hard).
The public key is the hard knapsack
⚫ can easily be used to encrypt but cannot be used to decrypt.
The private key is the easy knapsack
⚫ gives an easy way to decrypt messages.
5
Public and Private Key
Private key: a superincreasing knapsack sequence
⚫ Example: {2, 3, 6, 13, 27,52}
Public key:
⚫ Take 2 numbers n and m where n and m have no common factors
⚫ m is greater than sum of all numbers in the private key
⚫ Multiply each value in private key with ‘n mod m’. For n=31, m=105:
• 2 * 31 mod 105 = 62
• 3 * 31 mod 105 = 93
• 6 * 31 mod 105 = 81
• 13 * 31 mod 105 = 88
• 27 * 31 mod 105 = 102
• 52 * 31 mod 105 = 37
⚫ Public key = {62, 93, 81, 88, 102, 37}
6
Encryption
Break the message into blocks equal to the number of
items in the knapsack sequence.
Compute the total weights of the knapsacks—one for
every message block.
For example,
⚫ m = 011000 110101 101110
⚫ b1= 011000, b2=110101, b3=101110
⚫ Public key = {62, 93, 81, 88, 102, 37}
⚫ sumb1 = 93 + 81 = 174
⚫ sumb2 = 62 + 93 + 88 + 37 = 280
⚫ sumb3 = 62 + 81 + 88 + 102 = 333
The ciphertext c=174,280,333
7
Decryption
Private key, m and n must be known
Determine n-1 such that n*(n-1 )=1 (mod m).
Multiply each of the ciphertext values by n-1 mod m
Partition with the private knapsack to get the plaintext
values.
8
Decryption
Example:
⚫ Private key = {2, 3, 6, 13, 27, 52}
⚫ m =105
⚫ n = 31
⚫ n-1 = 61
⚫ c = 174, 280, 333.
⚫ p1 = 174 * 61 mod 105 = 9 = 3 + 6 = 011000
⚫ p2 = 280 * 61 mod 105 = 70 = 2 + 3 + 13 + 52 = 110101
⚫ p3 = 333 * 61 mod 105 = 48 = 2 + 6 + 13 + 27 =101110
m = 011000 110101 101110.
9
Security of Knapsacks
10