1 comment

[ 3.6 ms ] story [ 11.9 ms ] thread
Both tweets joined together:

    openssl ecparam -noout -name secp256k1 -genkey \
  | tee >( lpr ) \
  | openssl ec -pubout -conv_form compressed -outform DER \
  | tail -c33 \
  | rhash - -p %@{sha-256} \
  | rhash - -p %@{ripemd160} \
  | perl -Mbigint -MDigest::SHA=sha256 -0777 -nE '
    ( $k = "\0$_" ) =~ /^\0*/;
    $l = 1 x $+[0];
    $k .= substr sha256(sha256 $k), 0, 4;
    $d = hex unpack "H*", $k;
    $a = ( grep /[^IOl]/, 1..9,A..Z,a..z )[ ($d->bdiv(58))[1] ] . $a while $d;
    say $l . $a;
  '
Replace `>( lpr )` wih `>( cat >/dev/stderr )` to see it in action without a printer