Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Merkle–Hellman knapsack cryptosystem
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Decryption=== To decrypt a ciphertext <math>c</math>, we must find the subset of <math>B</math> which sums to <math>c</math>. We do this by transforming the problem into one of finding a subset of <math>W</math>. That problem can be solved in polynomial time since <math>W</math> is superincreasing. 1. Calculate the [[modular inverse]] of <math>r</math> modulo <math>q</math> using the [[Extended Euclidean algorithm]]. The inverse will exist since <math>r</math> is coprime to <math>q</math>. :<math>r' := r^{-1} \pmod q</math> :The computation of <math>r'</math> is independent of the message, and can be done just once when the private key is generated. 2. Calculate :<math>c' := c r' \bmod q</math> 3. Solve the subset sum problem for <math>c'</math> using the superincreasing sequence <math>W</math>, by the simple greedy algorithm described below. Let <math>X = (x_1, x_2, \dots, x_k)</math> be the resulting list of indexes of the elements of <math>W</math> which sum to <math>c'</math>. (That is, <math>c' = \sum_{i=1}^k w_{x_i}</math>.) 4. Construct the message <math>m</math> with a 1 in each <math>x_i</math> bit position and a 0 in all other bit positions: :<math>m = \sum_{i=1}^k 2^{n-x_i}</math> ====Solving the subset sum problem==== This simple greedy algorithm finds the subset of a superincreasing sequence <math>W</math> which sums to <math>c'</math>, in polynomial time: :1. Initialize <math>X</math> to an empty list. :2. Find the largest element in <math>W</math> which is less than or equal to <math>c'</math>, say <math>w_j</math>. :3. Subtract: <math>c' := c' - w_j</math>. :4. Append <math>j</math> to the list <math>X</math>. :5. Remove <math>w_j</math> from the superincreasing sequence <math>W</math> :6. If <math>c'</math> is greater than zero, return to step 2.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Merkle–Hellman knapsack cryptosystem
(section)
Add topic