Piston addkey problem (hangs after password is entered)

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@sigmajin·
0.000 HBD
Piston addkey problem (hangs after password is entered)
Edit:  see @xeroc 's reply below for the correct explanation and fix

I encountered a problem getting Piston to work correctly that I have not seen discussed.  I managed to figure out a fix myself, so I'm partially posting this because I feel like a genius and want to brag, but mostly in case anyone has the same problem and needs a reference.

When I installed piston, It worked fine except for one problem.  I could not use the "addkey" function.  Any time I tried, Piston would ask for my wallet password, and then hang indefinitely until I broke out with control-c.  It produced this:

```
^CTraceback (most recent call last):
  File "/home/sigmajin/.local/bin/piston", line 11, in <module>
    sys.exit(main())
  File "/home/sigmajin/.local/lib/python3.5/site-packages/piston/__main__.py", line 816, in main
    pub = (steem.wallet.addPrivateKey(wifkey))
  File "/home/sigmajin/.local/lib/python3.5/site-packages/piston/wallet.py", line 243, in addPrivateKey
    self.keyStorage.add(self.encrypt_wif(wif), pub)
  File "/home/sigmajin/.local/lib/python3.5/site-packages/piston/wallet.py", line 187, in encrypt_wif
    return format(bip38.encrypt(PrivateKey(wif), self.masterpassword), "encwif")
  File "/home/sigmajin/.local/lib/python3.5/site-packages/graphenebase/bip38.py", line 61, in encrypt
    key           = scrypt.scrypt(bytes(passphrase, "utf-8"), salt, 16384, 8, 8)
  File "/home/sigmajin/.local/lib/python3.5/site-packages/pylibscrypt/pypyscrypt_inline.py", line 212, in scrypt
    smix(B, i * 32 * r, r, N, V, XY)
  File "/home/sigmajin/.local/lib/python3.5/site-packages/pylibscrypt/pypyscrypt_inline.py", line 175, in smix
    blockmix_salsa8(X, 32 * r, r)                  # ROMix - 9(outer)
  File "/home/sigmajin/.local/lib/python3.5/site-packages/pylibscrypt/pypyscrypt_inline.py", line 155, in blockmix_salsa8
    salsa20_8(X, tmp, BY, i * 16, BY, Yi + i*16)   # BlockMix - 3(outer)
  File "/home/sigmajin/.local/lib/python3.5/site-packages/pylibscrypt/pypyscrypt_inline.py", line 77, in salsa20_8
```

I'm don't know anything about programming, so obviously, I have no idea what any of this means, but I was able to find someone who had experienced a similar problem that produced a similar traceback with another program here:

https://github.com/cathalgarvey/deadlock/issues/4

The solution given for this program was to upgrade to the latest version, which included a fix.  So I just installed the program (called deadlock), and it fixed my issue .  I'm sure there is a better way to do it, but I wasn't really clear enough on the explanation to try and figure it out.

Hopefully, this post saves someone a little bit of time.

EDIT:  though the above worked for me, the real and more direct fix (courtesy of @xeroc in the comments) is :
`pip3 install scrypt`
👍 , , , , , , , , , , , , , , , , , , , , , , , ,