This repository contains compiled static library of https://github.com/herumi/bls with BLS_ETH=1
.
- SecretKey; Fr
- PublicKey; G1
- Sign; G2
- 2023/Aug/17 The performance of Sign is a little improved.
- 2023/Jun/12 move static libraries to release branch
- 2021/Jan/28 (change specification) enable VerifySignatureOrder and VerifyPublicKeyOrder by default
- 2021/Jan/28 (change specification) verify returns false for zero public key
- 2021/Jan/02 support arm64 golang on M1 mac
- 2020/Oct/15
add SecretKey::GetSafePublicKey()
, which returns an error if sec is zero - 2020/Oct/08
MultiVerify
returns true only if all signatures are valid. - 2020/Sep/18 static binary for x64 is JIT-less mode, which uses code pre-generated by Xbyak.
- 2020/Jul/03 remove old tests and use the latest hash function defined at draft-07 is set by default.
- 2020/May/22
SignHashWithDomain
,VerifyHashWithDomain
,VerifyAggregateHashWithDomain
are removed. - 2020/May/15
EthModeDraft07
is added for draft-07. - 2020/Apr/20
EthModeDraft06
is default. CallSetETHmode(EthModeDraft05)
to use older evrsion. - 2020/Mar/26 The signature value in
SetETHmode(2)
has changed because of changing DST in hash-to-curve function. - 2020/Mar/17 This library supports eth2.0 functions. But the spec of hash-to-curve function may be changed.
Init as the followings:
Init(BLS12_381)
then, you can use the following functions.
bls-eth-go-binary | eth2.0 spec name |
---|---|
SecretKey::SignByte | Sign |
PublicKey::VerifyByte | Verify |
Sign::Aggregate | Aggregate |
Sign::FastAggregateVerify | FastAggregateVerify |
Sign::AggregateVerifyNoCheck | AggregateVerify |
The size of message must be 32 byte.
Check functions:
- VerifySignatureOrder ; make
deserialize
check the correctness of the order - Sign::IsValidOrder ; check the correctness of the order
- VerifyPublicKeyOrder ; make
deserialize
check the correctness of the order - PublicKey::IsValidOrder ; check the correctness of the order
- AreAllMsgDifferent ; check that all messages are different each other
go get github.com/herumi/bls-eth-go-binary/
go run examples/sample.go
The following steps are not necessary if you use compiled binary in this repository.
git clone --recursive https://github.com/herumi/bls-go-binary
cd bls-go-binary
#git submodule update --init --recursive
go test ./bls -bench "Pairing|Sign|Verify" -count=1
On x64 Linux,
make
Otherwise, clang is necessary to build ll files.
make CXX=clang++
make ARCH=x86_64 # for Intel mac
make ARCH=arm64 # for M1 mac
sudo apt-get install gcc-multilib
make -C src/bls -f Makefile.onelib build_aarch64 CXX=clang++ -j OUT_DIR=../..
make android
If you need a shared library, then after make clean
,
make android BLS_LIB_SHARED=1
make ios
Check llc --version
shows to support the target armv7a.
make ../mcl/src/base32.ll
env CXX=clang++ BIT=32 ARCH=arm _OS=android _ARCH=armeabi-v7a make MCL_USE_GMP=0 UNIT=4 CFLAGS_USER="-target armv7a-linux-eabi -fPIC"
- Remark : clang++ must support
armv7a-linux-eabi
.
env CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARM=7 GOARCH=arm go build examples/sample.go
env QEMU_LD_PREFIX=/usr/arm-linux-gnueabi qemu-arm ./sample
Check llc --version
shows to support the target mips.
make ../mcl/src/base32.ll
env CXX=clang++ BIT=32 ARCH=mipsel _OS=linux _ARCH=mipsle make MCL_USE_GMP=0 UNIT=4 CFLAGS_USER="-target mipsel-linux -fPIC"
- Remark : clang++ must support
mipsel-linux
.
env CC=mipsel-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build examples/sample.go
env QEMU_LD_PREFIX=/usr/mipsel-linux-gnu qemu-mipsel ./sample
#define BLS_ETH
#include <mcl/bn_c384_256.h>
#include <bls/bls.h>
MITSUNARI Shigeo(herumi@nifty.com)