uwiger / erlang-tc

Erlang NIF for threshold_crypto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

erlang_tc

Erlang bindings for threshold_crypto.

NOTE: We advise not to use the erlang_tc module directly, preferably use the submodules for performing various threshold cryptography functions.

Usage

Verfy basic secret key usage.

1> SK0 = tc_secret_key:random().
#Ref<0.989752667.1337851906.91190>
2> SK1 = tc_secret_key:random().
#Ref<0.989752667.1337851906.91197>
3> PK0 = tc_secret_key:public_key(SK0).
#Ref<0.989752667.1337851906.91209>
4> MSG0 = <<"real news">>.
<<"real news">>
5> MSG1 = <<"fake news">>.
<<"fake news">>
6> %% correct
6> tc_pubkey:verify(PK0, tc_secret_key:sign(SK0, MSG0), MSG0).
true
7> %% wrong key
7> tc_pubkey:verify(PK0, tc_secret_key:sign(SK1, MSG0), MSG0).
false
8> %% wrong msg
8> tc_pubkey:verify(PK0, tc_secret_key:sign(SK0, MSG1), MSG0).
false

Build

$ make

Test

$ make test

About

Erlang NIF for threshold_crypto

License:Apache License 2.0


Languages

Language:Erlang 75.3%Language:Rust 24.5%Language:Makefile 0.2%