Fixing incorrect PIN computation on 64-bit platforms

Applies patch referenced in original issue. Fixes #373.