singpolyma / mnemonicode

Fork of http://web.archive.org/web/20101031205747/http://www.tothink.com/mnemonic/
MIT License
153 stars 20 forks source link

Decoding an encoded string does not always return the original string #5

Closed ossguy closed 6 years ago

ossguy commented 6 years ago

Per https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718931 there are certain strings that, once encoded, cannot be decoded back to the original string.

I did a review of the commit history since that old code was imported into this project, but I didn't see anything in the list that is likely to have fixed this. I haven't tested the specific case described at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718931 with the latest code here, but I can if needed.

ossguy commented 6 years ago

This might already be solved by https://github.com/singpolyma/mnemonicode/commit/179987457e135b5477d78d5ce5c56f666fd2c668 (as discussed in #1) but I don't know for sure.

dchapes commented 6 years ago

I can confirm this was fixed by mentioned commit.

With 1c1e66bfbb9b :

% xxd /tmp/mntest.raw ; ./mnencode < /tmp/mntest.raw | tee /dev/stderr | ./mndecode | xxd
00000000: 610b 28b5 5cfc fe45 ea1b 563b 3116 ba5e  a.(.\..E..V;1..^
00000010: 9ffa 69a3                                ..i.
 Wordlist ver 0.7
field electra pablo. address flower memo. verbal denver kermit
billy contour product. greek slow lucas
00000000: e9e0 f952 5cfc fe45 ea1b 563b 3116 ba5e  ...R\..E..V;1..^
00000010: 27d0 3b41                                '.;A

With 179987457e13 (and head):

% xxd /tmp/mntest.raw ; ./mnencode < /tmp/mntest.raw | tee /dev/stderr | ./mndecode | xxd
00000000: 610b 28b5 5cfc fe45 ea1b 563b 3116 ba5e  a.(.\..E..V;1..^
00000010: 9ffa 69a3                                ..i.
 Wordlist ver 0.7
viking imagine miguel. address flower memo. verbal denver kermit
billy contour product. pacific toyota snake
00000000: 610b 28b5 5cfc fe45 ea1b 563b 3116 ba5e  a.(.\..E..V;1..^
00000010: 9ffa 69a3