keybase / keybase-issues

A single repo for managing publicly recognized issues with the keybase client, installer, and website.
900 stars 37 forks source link

Reproducing twitter hash #1546

Closed jodersky closed 9 years ago

jodersky commented 9 years ago

Hi, I'm trying to recreate the hash displayed on twitter from a signed statement using standard unix tools.

The description given here, says:

Tweet-sized hash

the first 27 bytes, web safe, of base64(SHA-256(binary(contents)))

So my first attempt was to copy the statement contents into statement.txt and then run

cat statement.txt | openssl dgst -binary -sha256 | openssl base64 | head -c 27

However, I get a different hash from the one displayed on keybase and twitter. I also tried various combinations of newlines and headers in the statement, however with no success.

Any pointers on the exact procedure to reproduce the hash?

zQueal commented 9 years ago

To the best of my knowledge you'd need to implement TripleSec to recreate the hash.

maxtaco commented 9 years ago

See here and here

jodersky commented 9 years ago
cat statement.txt | openssl base64 -d | openssl dgst -sha256 | awk '{ print $2 } ' | xxd -r -p | openssl base64 -e

did the trick. Thanks!