I am trying to implement an algorithm that finds the key of the RC4 cipher from the inner permutation. For each key byte I have several options, each with different weight. Is there any way, to test first the possibilities with highest weight, than with second highest, and so on?
Basically what I need is to generate vectors like this (for 3 byte key):
[0,0,0] [1,0,0] [0,1,0] [0,0,1] [1,1,0] [1,0,1] [0,1,1] [1,1,1] [2,1,1] ...
So it is sorted by sum.
(I have the bytes stored in a table sorted by weight, highest weight on the top.)
A similar problem is solved here: application of Dijkstra's algorithm, but I don't know how to apply it to my problem.
The paper only mentions that they do it in iterative depth manner.
Is there any algorithm which solves this problem?