Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Breaking the Knapsack Algorithm

created by st.augustine

(idea) by st.augustine (9.2 mon) (print)   ?   (I like it!) Fri Apr 06 2001 at 2:43:34

Breaking the knapsack algorithm involves finding the values k and m such that m*a((i) (mod k) forms a superincreasing set (s(i)), where a(i) is the public set of weights. In the graph y = m*a1(mod k), a(i) is the slope of the function, and discontinuities fall on the values: m = ( (k/a(1)), (2k/a(1)) ... ((a(1)-1)k/a(1))).

m*a(1) (mod k) or y is less than 2(-n+1)*k, where n is the number of weights in the knapsack, because each element in the superincreasing sack must be at least twice the previous. Therefore, m must fall on the interval ((pk/a(1)), (pk/a(1) + (2(-n+1)k/a(1))). where p equals {1 .. (a(1) -1)}. Dividing the set by k leads to the ratio m/k falling on the interval ((p/a(1)),((p/a(1)) + (1/(a(1)*2(n-1)))) meaning the ratio falls on on of the intervals defined by the discontinuities on the graph y=m*a(1) (mod k).

This procedure works with the second weight a(2), where the ratio m/k can have the values on the interval ((q/a(2)),((q/a(2)) + (1/(a(2)*2(n-2)))) where q = {1...a(2)-1}. Both the first and second intervals must contain m/k, and therefore the possible interval on which m/k may fall is limited to the intersection of the above mentioned.

Increasing the number of weights decreases further the interval, and thus with as few as 4 weights (m,k) may be determined by trial and error.

Sources: Applied Cryptography by Bruce Schneier

printable version
chaos

knapsack algorithm .cc trial and error Determining if a linked list loops using only two pointers
Lithium The Wind in the Willows Higher-order function
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Look at this mess the Death Borg made!
How Prom nearly killed me
Trying to explain Everything to your non-Everythingite friends
Drywall
Kahlil Gibran
Fifteen Men on a Dead Man's Chest
Being with an older woman
I don't rewrite my poetry
Northern Ireland
The demon was just under three feet tall
Vaclav Havel's address to the US Congress, 21 February 1990
OBD-II
When the Sun Rises
Cotton Club
New Writeups
Glowing Fish
Tualatin River(place)
The Jacket
Words of Advice(idea)
keepinitreal
Why buy the cow when you can get the milk for free?(idea)
John_Fox
Good Intentions Gone Wrong(person)
Cuckowski
Slavonic Princess(poetry)
Heitah
Posthumous Oscar(thing)
ignis_glaciesque
University of South Florida(place)
ignis_glaciesque
Flogstaskriket(idea)
liveforever
Caesar's last breath(idea)
dagnyswaggart
she wants to believe(personal)
antigravpussy
he doesn't know, but her eyes widen too far(thing)
dagnyswaggart
Wild tides guard her secrets(poetry)
Lord Brawl
Caesar's last breath(poetry)
locke baron
Forgotten things in space(fiction)
sitaraika
Colours(idea)
This affordable entertainment brought to you by The Everything Development Company