in reply to LFSRs & binary encode / decode functions
Isn't the point of a LFSR that it cannot be decoded?
Besides which, for 20-bit numbers there are only 1e6 mappings, so it would be easier and faster to set up a pair of lookup tables (One time pad):
use List::Util qw[ shuffle ];; @n = 1 .. 2**20;; @encoded = shuffle @n;; @encode{ @n } = @encoded;; @decode{ @encoded } = @n;; print total_size $_ for \( %encode, %decode );; 44036216 44068014
One-time pads are the safest encryption mechanism (used properly!), and < 100MB very easy to generate.
Of course, using them properly means never re-using them which can present an off-line storage problem, but an entire pad can be reduced to ~2.5MB. How many would you need?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: LFSRs & binary encode / decode functions
by zardoz99 (Initiate) on Jul 03, 2009 at 02:04 UTC | |
by BrowserUk (Patriarch) on Jul 03, 2009 at 05:12 UTC |