paulperegud / safecat

A CLI tool to for crypto functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Safecat

safecat logo, generated by stable diffusion and gimp

A simple CLI tool to generate, sign, and verify digital signatures using EdDSA Baby Jubjub Elliptic Curve signatures and a Poseidon hash function.

See the announcement article for more details.

compile

Install Rust, and run cargo build.

usage

  1. safecat generate. Generates a new EdDSA Baby Jubjub Elliptic Curve private-public key.

    The private key is saved in a file priv.key, which is not encrypted! Unsafe indeed.

  2. safecat show. Shows the last generated private-public keys. You can choose which format to show, hex or detailed. You need "detailed" if you want to verify the signature in Noir, and "hex" if you verify with safecat.

    Here's how you show the detailed format:

    safecat show --format detailed
    

    and here's how you show the hex format:

    safecat show --format hex
    
  3. safecat sign "message". Signs a message using the last generated private-public key. By default, the message is hashed using the Poseidon hash function, but you can change it to SHA-256 using the --hash option. You can also choose a format as before.

    safecat sign --hash sha256 --format hex "hello world"
    
  4. safecat verify "message" <signature> <public key>. Verifies an existing signature of a message. By default, it assumed the message was hashed using Poseidon, but you can change it to SHA-256 using the --hash option like before. The signature and public key must be given in a hex form.

    Verify commands are a bit long since the signature and public keys are long, so here's an example of how to use them. It doesn't look pretty.

    safecat verify "hello world" 245a157dc8e23ea8a0ab41b1c2d95ee7d59db5b76cba54b6f10630e5e0aefbdd140996400320386a9a2ec4b06ea7d1c885cd311751445ea171af1ab64dba5ace0420d34429497da49443ae35deb8e3daa745dc0e776df3703640078a67982cad 12055e5d761fd705d1f234770fc55b2cfdfd91e741d8f43b2a88cb5a88f9c1c01061ca2f21151da2903e7ccdf11dbda65c20851dd1df4ac522431041ea1738f9
    

Limitations

Poseidon hash is limited to strings of 16 characters.

About

A CLI tool to for crypto functions


Languages

Language:Rust 91.8%Language:Roff 8.2%