singpolyma / mnemonicode

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

mndecode and mnencode aren't always inverses on 64-bit Linux #1

Closed tmakarios closed 9 years ago

tmakarios commented 9 years ago

For example,

echo "edition right joseph" | mndecode -x | mnencode -x

yields "axiom pattern xray".

singpolyma commented 9 years ago

I cannot reproduce this issue on my machine.

tmakarios commented 9 years ago

That's interesting. I'm using commit 0d58973 and building it by running make on Trisquel 7.0.

singpolyma commented 9 years ago

... I have exactly the same commit and OS. I'm on a Gluglug X60. My output:

$ echo "edition right joseph" | ./mndecode -x | ./mnencode -x
 Wordlist ver 0.7
edition right joseph
tmakarios commented 9 years ago

I'm on an Intel NUC DN2820FYKH. I might test it on another computer later.

singpolyma commented 9 years ago

Does make clean and then make behave the same? I assume it does, but worth checking...

tmakarios commented 9 years ago

make clean followed by make doesn't make a difference to the program's behaviour.

I get the same behaviour on a Toshiba Satellite Pro C650 running Ubuntu 12.04.5.

Here's what happens if I just decode:

$ echo "edition right joseph" | ./mndecode -x
CE519CDE

so it looks like mnencode is the one behaving differently for me.

Aha! I just tried it on a ThinkPad T43 also running Ubuntu 12.04.5, and it works there. The difference? The ThinkPad is running 32-bit Linux; the other two computers are running 64-bit Linux.

singpolyma commented 9 years ago

@tmakarios please check if 179987457e135b5477d78d5ce5c56f666fd2c668 fixes your issue

tmakarios commented 9 years ago

I tested that commit on several different 64 KiB files I obtained from /dev/urandom, and each time I got this:

$ diff -s ~/random <(cat ~/random | ./mnencode | ./mndecode)
 Wordlist ver 0.7
Files /home/tim/random and /dev/fd/63 are identical

So yes, I think I can say that fixes the bug for me. Thanks!