diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-23 15:17:52 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 911bb2856c3eb4c1a74fab281fcda7033aa5c6d6 (patch) | |
tree | dbd93cdae49a2812908713f2d9fccddf715e8693 /vendor/github.com/dexon-foundation/bls | |
parent | ed9544ce6c9c9525f9fcf9c10d11010734c9da13 (diff) | |
download | dexon-911bb2856c3eb4c1a74fab281fcda7033aa5c6d6.tar dexon-911bb2856c3eb4c1a74fab281fcda7033aa5c6d6.tar.gz dexon-911bb2856c3eb4c1a74fab281fcda7033aa5c6d6.tar.bz2 dexon-911bb2856c3eb4c1a74fab281fcda7033aa5c6d6.tar.lz dexon-911bb2856c3eb4c1a74fab281fcda7033aa5c6d6.tar.xz dexon-911bb2856c3eb4c1a74fab281fcda7033aa5c6d6.tar.zst dexon-911bb2856c3eb4c1a74fab281fcda7033aa5c6d6.zip |
vendor: use govendor to import dexon-consensus-core
Diffstat (limited to 'vendor/github.com/dexon-foundation/bls')
22 files changed, 3400 insertions, 0 deletions
diff --git a/vendor/github.com/dexon-foundation/bls/Makefile b/vendor/github.com/dexon-foundation/bls/Makefile new file mode 100644 index 000000000..8ce73a5a1 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/Makefile @@ -0,0 +1,140 @@ +include ../mcl/common.mk +LIB_DIR=lib +OBJ_DIR=obj +EXE_DIR=bin +CFLAGS += -std=c++11 +LDFLAGS += -lpthread + +SRC_SRC=bls_c256.cpp bls_c384.cpp +TEST_SRC=bls256_test.cpp bls384_test.cpp bls_c256_test.cpp bls_c384_test.cpp +SAMPLE_SRC=bls256_smpl.cpp bls384_smpl.cpp + +CFLAGS+=-I../mcl/include -I./ +ifneq ($(MCL_MAX_BIT_SIZE),) + CFLAGS+=-DMCL_MAX_BIT_SIZE=$(MCL_MAX_BIT_SIZE) +endif +ifeq ($(DISABLE_THREAD_TEST),1) + CFLAGS+=-DDISABLE_THREAD_TEST +endif + +SHARE_BASENAME_SUF?=_dy + +BLS256_LIB=$(LIB_DIR)/libbls256.a +BLS384_LIB=$(LIB_DIR)/libbls384.a +BLS256_SNAME=bls256$(SHARE_BASENAME_SUF) +BLS384_SNAME=bls384$(SHARE_BASENAME_SUF) +BLS256_SLIB=$(LIB_DIR)/lib$(BLS256_SNAME).$(LIB_SUF) +BLS384_SLIB=$(LIB_DIR)/lib$(BLS384_SNAME).$(LIB_SUF) +all: $(BLS256_LIB) $(BLS256_SLIB) $(BLS384_LIB) $(BLS384_SLIB) + +MCL_LIB=../mcl/lib/libmcl.a + +$(MCL_LIB): + $(MAKE) -C ../mcl lib/libmcl.a + +ifeq ($(DOCKER),alpine) +GMP_PREFIX=/usr/lib +OPENSSL_PREFIX=/usr/lib +else ifeq ($(OS),mac) +GMP_PREFIX=$(shell brew --prefix gmp)/lib +OPENSSL_PREFIX=$(shell brew --prefix openssl)/lib +else +GMP_PREFIX=/usr/lib/x86_64-linux-gnu +OPENSSL_PREFIX=/usr/lib/x86_64-linux-gnu +endif + +GMP_STATIC_LIB=$(GMP_PREFIX)/libgmp.a +GMPXX_STATIC_LIB=$(GMP_PREFIX)/libgmpxx.a + +OPENSSL_STATIC_LIB=$(OPENSSL_PREFIX)/libcrypto.a + +$(BLS256_LIB): $(OBJ_DIR)/bls_c256.o + $(AR) $@ $< +$(BLS384_LIB): $(OBJ_DIR)/bls_c384.o $(MCL_LIB) + rm -rf tmp + mkdir -p tmp + cd tmp && \ + ar x ../$(MCL_LIB) && \ + ar x $(OPENSSL_STATIC_LIB) && \ + ar x $(GMP_STATIC_LIB) && \ + ar x $(GMPXX_STATIC_LIB) + $(AR) $@ $< tmp/*.o + rm -rf tmp + +ifneq ($(findstring $(OS),mac/mingw64),) + BLS256_SLIB_LDFLAGS+=-lgmpxx -lgmp -lcrypto -lstdc++ + BLS384_SLIB_LDFLAGS+=-lgmpxx -lgmp -lcrypto -lstdc++ +endif +ifeq ($(OS),mingw64) + CFLAGS+=-I../mcl + BLS256_SLIB_LDFLAGS+=-Wl,--out-implib,$(LIB_DIR)/lib$(BLS256_SNAME).a + BLS384_SLIB_LDFLAGS+=-Wl,--out-implib,$(LIB_DIR)/lib$(BLS384_SNAME).a +endif +$(BLS256_SLIB): $(OBJ_DIR)/bls_c256.o $(MCL_LIB) + $(PRE)$(CXX) -shared -o $@ $< $(MCL_LIB) $(BLS256_SLIB_LDFLAGS) +$(BLS384_SLIB): $(OBJ_DIR)/bls_c384.o $(MCL_LIB) + $(PRE)$(CXX) -shared -o $@ $< $(MCL_LIB) $(BLS384_SLIB_LDFLAGS) + +VPATH=test sample src + +.SUFFIXES: .cpp .d .exe + +$(OBJ_DIR)/%.o: %.cpp + $(PRE)$(CXX) $(CFLAGS) -c $< -o $@ -MMD -MP -MF $(@:.o=.d) + +$(EXE_DIR)/%384_test.exe: $(OBJ_DIR)/%384_test.o $(BLS384_LIB) $(MCL_LIB) + $(PRE)$(CXX) $< -o $@ $(BLS384_LIB) -lmcl -L../mcl/lib $(LDFLAGS) + +$(EXE_DIR)/%256_test.exe: $(OBJ_DIR)/%256_test.o $(BLS256_LIB) $(MCL_LIB) + $(PRE)$(CXX) $< -o $@ $(BLS256_LIB) -lmcl -L../mcl/lib $(LDFLAGS) + +# sample exe links libbls256.a +$(EXE_DIR)/%.exe: $(OBJ_DIR)/%.o $(BLS256_LIB) $(MCL_LIB) + $(PRE)$(CXX) $< -o $@ $(BLS256_LIB) -lmcl -L../mcl/lib $(LDFLAGS) + +SAMPLE_EXE=$(addprefix $(EXE_DIR)/,$(SAMPLE_SRC:.cpp=.exe)) +sample: $(SAMPLE_EXE) + +TEST_EXE=$(addprefix $(EXE_DIR)/,$(TEST_SRC:.cpp=.exe)) +test: $(TEST_EXE) + @echo test $(TEST_EXE) + @sh -ec 'for i in $(TEST_EXE); do $$i|grep "ctest:name"; done' > result.txt + @grep -v "ng=0, exception=0" result.txt; if [ $$? -eq 1 ]; then echo "all unit tests succeed"; else exit 1; fi + $(MAKE) sample_test + +sample_test: $(EXE_DIR)/bls_smpl.exe + python bls_smpl.py + +ifeq ($(OS),mac) + MAC_GO_LDFLAGS="-ldflags=-s" +endif +# PATH is for mingw, LD_RUN_PATH is for linux, DYLD_LIBRARY_PATH is for mac +test_go: ffi/go/bls/bls.go ffi/go/bls/bls_test.go $(BLS384_LIB) + cd ffi/go/bls && go test $(MAC_GO_LDFLAGS) . + +EMCC_OPT=-I./include -I./src -I../mcl/include -I./ -Wall -Wextra +EMCC_OPT+=-O3 -DNDEBUG +EMCC_OPT+=-s WASM=1 -s NO_EXIT_RUNTIME=1 -s MODULARIZE=1 #-s ASSERTIONS=1 +EMCC_OPT+=-DCYBOZU_MINIMUM_EXCEPTION +EMCC_OPT+=-s ABORTING_MALLOC=0 +EMCC_OPT+=-DMCLBN_FP_UNIT_SIZE=6 +JS_DEP=src/bls_c384.cpp ../mcl/src/fp.cpp Makefile + +../bls-wasm/bls_c.js: $(JS_DEP) + emcc -o $@ src/bls_c384.cpp ../mcl/src/fp.cpp $(EMCC_OPT) -DMCL_MAX_BIT_SIZE=384 -DMCL_USE_WEB_CRYPTO_API -s DISABLE_EXCEPTION_CATCHING=1 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -DMCL_DONT_USE_CSPRNG -fno-exceptions -MD -MP -MF obj/bls_c384.d + +bls-wasm: + $(MAKE) ../bls-wasm/bls_c.js + +clean: + $(RM) $(OBJ_DIR)/*.d $(OBJ_DIR)/*.o $(EXE_DIR)/*.exe $(GEN_EXE) $(ASM_SRC) $(ASM_OBJ) $(LLVM_SRC) $(BLS256_LIB) $(BLS256_SLIB) $(BLS384_LIB) $(BLS384_SLIB) + +ALL_SRC=$(SRC_SRC) $(TEST_SRC) $(SAMPLE_SRC) +DEPEND_FILE=$(addprefix $(OBJ_DIR)/, $(ALL_SRC:.cpp=.d)) +-include $(DEPEND_FILE) + +.PHONY: test bls-wasm + +# don't remove these files automatically +.SECONDARY: $(addprefix $(OBJ_DIR)/, $(ALL_SRC:.cpp=.o)) + diff --git a/vendor/github.com/dexon-foundation/bls/bls.sln b/vendor/github.com/dexon-foundation/bls/bls.sln new file mode 100644 index 000000000..4889ec601 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/bls.sln @@ -0,0 +1,30 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bls_test", "test\proj\bls_test\bls_test.vcxproj", "{51266DE6-B57B-4AE3-B85C-282F170E1728}" + ProjectSection(ProjectDependencies) = postProject + {1DBB979A-C212-45CD-9563-446A96F87F71} = {1DBB979A-C212-45CD-9563-446A96F87F71} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bls", "src\proj\bls.vcxproj", "{1DBB979A-C212-45CD-9563-446A96F87F71}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {51266DE6-B57B-4AE3-B85C-282F170E1728}.Debug|x64.ActiveCfg = Debug|x64 + {51266DE6-B57B-4AE3-B85C-282F170E1728}.Debug|x64.Build.0 = Debug|x64 + {51266DE6-B57B-4AE3-B85C-282F170E1728}.Release|x64.ActiveCfg = Release|x64 + {51266DE6-B57B-4AE3-B85C-282F170E1728}.Release|x64.Build.0 = Release|x64 + {1DBB979A-C212-45CD-9563-446A96F87F71}.Debug|x64.ActiveCfg = Debug|x64 + {1DBB979A-C212-45CD-9563-446A96F87F71}.Debug|x64.Build.0 = Debug|x64 + {1DBB979A-C212-45CD-9563-446A96F87F71}.Release|x64.ActiveCfg = Release|x64 + {1DBB979A-C212-45CD-9563-446A96F87F71}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vendor/github.com/dexon-foundation/bls/bls_smpl.py b/vendor/github.com/dexon-foundation/bls/bls_smpl.py new file mode 100644 index 000000000..f834d80aa --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/bls_smpl.py @@ -0,0 +1,40 @@ +import os, sys, subprocess + +EXE='bin/bls_smpl.exe' + +def init(): + subprocess.check_call([EXE, "init"]) + +def sign(m, i=0): + subprocess.check_call([EXE, "sign", "-m", m, "-id", str(i)]) + +def verify(m, i=0): + subprocess.check_call([EXE, "verify", "-m", m, "-id", str(i)]) + +def share(n, k): + subprocess.check_call([EXE, "share", "-n", str(n), "-k", str(k)]) + +def recover(ids): + cmd = [EXE, "recover", "-ids"] + for i in ids: + cmd.append(str(i)) + subprocess.check_call(cmd) + +def main(): + m = "hello bls threshold signature" + n = 10 + ids = [1, 5, 3, 7] + k = len(ids) + init() + sign(m) + verify(m) + share(n, k) + for i in ids: + sign(m, i) + verify(m, i) + subprocess.check_call(["rm", "sample/sign.txt"]) + recover(ids) + verify(m) + +if __name__ == '__main__': + main() diff --git a/vendor/github.com/dexon-foundation/bls/common.props b/vendor/github.com/dexon-foundation/bls/common.props new file mode 100644 index 000000000..d6fdbb902 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/common.props @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <OutDir>$(SolutionDir)bin\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>$(SolutionDir)../cybozulib/include;$(SolutionDir)../cybozulib_ext/include;$(SolutionDir)include;$(SolutionDir)../mcl/include</AdditionalIncludeDirectories> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup> + <ClCompile> + <WarningLevel>Level4</WarningLevel> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <PrecompiledHeaderFile /> + <PrecompiledHeaderOutputFile /> + <PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);NOMINMAX;BLS_MAX_OP_UNIT_SIZE=6</PreprocessorDefinitions> + </ClCompile> + <Link> + <AdditionalLibraryDirectories>$(SolutionDir)../cybozulib_ext/lib;$(SolutionDir)../mcl/lib;$(SolutionDir)lib</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemGroup /> +</Project> diff --git a/vendor/github.com/dexon-foundation/bls/debug.props b/vendor/github.com/dexon-foundation/bls/debug.props new file mode 100644 index 000000000..1553ae0dc --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/debug.props @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <TargetName>$(ProjectName)d</TargetName> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls.go b/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls.go new file mode 100644 index 000000000..b6ffe49d0 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/ffi/go/bls/bls.go @@ -0,0 +1,420 @@ +package bls + +/* +#cgo CFLAGS:-I../../../include -I../../../../mcl/include/ +#cgo LDFLAGS:${SRCDIR}/../../../lib/libbls384.a -lstdc++ +#cgo CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 +#include <bls/bls.h> +*/ +import "C" +import "fmt" +import "unsafe" +import "encoding/json" + +// Init -- +// call this function before calling all the other operations +// this function is not thread safe +func Init(curve int) error { + err := C.blsInit(C.int(curve), C.MCLBN_COMPILED_TIME_VAR) + if err != 0 { + return fmt.Errorf("ERR Init curve=%d", curve) + } + return nil +} + +// ID -- +type ID struct { + v Fr +} + +// getPointer -- +func (id *ID) getPointer() (p *C.blsId) { + // #nosec + return (*C.blsId)(unsafe.Pointer(id)) +} + +// GetLittleEndian -- +func (id *ID) GetLittleEndian() []byte { + return id.v.Serialize() +} + +// SetLittleEndian -- +func (id *ID) SetLittleEndian(buf []byte) error { + return id.v.SetLittleEndian(buf) +} + +// GetHexString -- +func (id *ID) GetHexString() string { + return id.v.GetString(16) +} + +// GetDecString -- +func (id *ID) GetDecString() string { + return id.v.GetString(10) +} + +// SetHexString -- +func (id *ID) SetHexString(s string) error { + return id.v.SetString(s, 16) +} + +// SetDecString -- +func (id *ID) SetDecString(s string) error { + return id.v.SetString(s, 10) +} + +// IsEqual -- +func (id *ID) IsEqual(rhs *ID) bool { + return id.v.IsEqual(&rhs.v) +} + +// MarshalJSON implements json.Marshaller. +func (id *ID) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + ID []byte `json:"id"` + }{ + id.GetLittleEndian(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (id *ID) UnmarshalJSON(data []byte) error { + aux := &struct { + ID []byte `json:"id"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := id.SetLittleEndian(aux.ID); err != nil { + return err + } + return nil +} + +// SecretKey -- +type SecretKey struct { + v Fr +} + +// getPointer -- +func (sec *SecretKey) getPointer() (p *C.blsSecretKey) { + // #nosec + return (*C.blsSecretKey)(unsafe.Pointer(sec)) +} + +// GetLittleEndian -- +func (sec *SecretKey) GetLittleEndian() []byte { + return sec.v.Serialize() +} + +// SetLittleEndian -- +func (sec *SecretKey) SetLittleEndian(buf []byte) error { + return sec.v.SetLittleEndian(buf) +} + +// SerializeToHexStr -- +func (sec *SecretKey) SerializeToHexStr() string { + return sec.v.GetString(IoSerializeHexStr) +} + +// DeserializeHexStr -- +func (sec *SecretKey) DeserializeHexStr(s string) error { + return sec.v.SetString(s, IoSerializeHexStr) +} + +// GetHexString -- +func (sec *SecretKey) GetHexString() string { + return sec.v.GetString(16) +} + +// GetDecString -- +func (sec *SecretKey) GetDecString() string { + return sec.v.GetString(10) +} + +// SetHexString -- +func (sec *SecretKey) SetHexString(s string) error { + return sec.v.SetString(s, 16) +} + +// SetDecString -- +func (sec *SecretKey) SetDecString(s string) error { + return sec.v.SetString(s, 10) +} + +// IsEqual -- +func (sec *SecretKey) IsEqual(rhs *SecretKey) bool { + return sec.v.IsEqual(&rhs.v) +} + +// SetByCSPRNG -- +func (sec *SecretKey) SetByCSPRNG() { + sec.v.SetByCSPRNG() +} + +// Add -- +func (sec *SecretKey) Add(rhs *SecretKey) { + FrAdd(&sec.v, &sec.v, &rhs.v) +} + +// GetMasterSecretKey -- +func (sec *SecretKey) GetMasterSecretKey(k int) (msk []SecretKey) { + msk = make([]SecretKey, k) + msk[0] = *sec + for i := 1; i < k; i++ { + msk[i].SetByCSPRNG() + } + return msk +} + +// MarshalJSON implements json.Marshaller. +func (sec *SecretKey) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + SecretKey []byte `json:"secret_key"` + }{ + sec.GetLittleEndian(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (sec *SecretKey) UnmarshalJSON(data []byte) error { + aux := &struct { + SecretKey []byte `json:"secret_key"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := sec.SetLittleEndian(aux.SecretKey); err != nil { + return err + } + return nil +} + +// GetMasterPublicKey -- +func GetMasterPublicKey(msk []SecretKey) (mpk []PublicKey) { + n := len(msk) + mpk = make([]PublicKey, n) + for i := 0; i < n; i++ { + mpk[i] = *msk[i].GetPublicKey() + } + return mpk +} + +// Set -- +func (sec *SecretKey) Set(msk []SecretKey, id *ID) error { + // #nosec + return FrEvaluatePolynomial(&sec.v, *(*[]Fr)(unsafe.Pointer(&msk)), &id.v) +} + +// Recover -- +func (sec *SecretKey) Recover(secVec []SecretKey, idVec []ID) error { + // #nosec + return FrLagrangeInterpolation(&sec.v, *(*[]Fr)(unsafe.Pointer(&idVec)), *(*[]Fr)(unsafe.Pointer(&secVec))) +} + +// GetPop -- +func (sec *SecretKey) GetPop() (sign *Sign) { + sign = new(Sign) + C.blsGetPop(sign.getPointer(), sec.getPointer()) + return sign +} + +// PublicKey -- +type PublicKey struct { + v G2 +} + +// getPointer -- +func (pub *PublicKey) getPointer() (p *C.blsPublicKey) { + // #nosec + return (*C.blsPublicKey)(unsafe.Pointer(pub)) +} + +// Serialize -- +func (pub *PublicKey) Serialize() []byte { + return pub.v.Serialize() +} + +// Deserialize -- +func (pub *PublicKey) Deserialize(buf []byte) error { + return pub.v.Deserialize(buf) +} + +// SerializeToHexStr -- +func (pub *PublicKey) SerializeToHexStr() string { + return pub.v.GetString(IoSerializeHexStr) +} + +// DeserializeHexStr -- +func (pub *PublicKey) DeserializeHexStr(s string) error { + return pub.v.SetString(s, IoSerializeHexStr) +} + +// GetHexString -- +func (pub *PublicKey) GetHexString() string { + return pub.v.GetString(16) +} + +// SetHexString -- +func (pub *PublicKey) SetHexString(s string) error { + return pub.v.SetString(s, 16) +} + +// IsEqual -- +func (pub *PublicKey) IsEqual(rhs *PublicKey) bool { + return pub.v.IsEqual(&rhs.v) +} + +// Add -- +func (pub *PublicKey) Add(rhs *PublicKey) { + G2Add(&pub.v, &pub.v, &rhs.v) +} + +// Set -- +func (pub *PublicKey) Set(mpk []PublicKey, id *ID) error { + // #nosec + return G2EvaluatePolynomial(&pub.v, *(*[]G2)(unsafe.Pointer(&mpk)), &id.v) +} + +// Recover -- +func (pub *PublicKey) Recover(pubVec []PublicKey, idVec []ID) error { + // #nosec + return G2LagrangeInterpolation(&pub.v, *(*[]Fr)(unsafe.Pointer(&idVec)), *(*[]G2)(unsafe.Pointer(&pubVec))) +} + +// MarshalJSON implements json.Marshaller. +func (pub *PublicKey) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + PublicKey []byte `json:"public_key"` + }{ + pub.Serialize(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (pub *PublicKey) UnmarshalJSON(data []byte) error { + aux := &struct { + PublicKey []byte `json:"public_key"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := pub.Deserialize(aux.PublicKey); err != nil { + return err + } + return nil +} + +// Sign -- +type Sign struct { + v G1 +} + +// getPointer -- +func (sign *Sign) getPointer() (p *C.blsSignature) { + // #nosec + return (*C.blsSignature)(unsafe.Pointer(sign)) +} + +// Serialize -- +func (sign *Sign) Serialize() []byte { + return sign.v.Serialize() +} + +// Deserialize -- +func (sign *Sign) Deserialize(buf []byte) error { + return sign.v.Deserialize(buf) +} + +// SerializeToHexStr -- +func (sign *Sign) SerializeToHexStr() string { + return sign.v.GetString(IoSerializeHexStr) +} + +// DeserializeHexStr -- +func (sign *Sign) DeserializeHexStr(s string) error { + return sign.v.SetString(s, IoSerializeHexStr) +} + +// GetHexString -- +func (sign *Sign) GetHexString() string { + return sign.v.GetString(16) +} + +// SetHexString -- +func (sign *Sign) SetHexString(s string) error { + return sign.v.SetString(s, 16) +} + +// IsEqual -- +func (sign *Sign) IsEqual(rhs *Sign) bool { + return sign.v.IsEqual(&rhs.v) +} + +// GetPublicKey -- +func (sec *SecretKey) GetPublicKey() (pub *PublicKey) { + pub = new(PublicKey) + C.blsGetPublicKey(pub.getPointer(), sec.getPointer()) + return pub +} + +// Sign -- Constant Time version +func (sec *SecretKey) Sign(m string) (sign *Sign) { + sign = new(Sign) + buf := []byte(m) + // #nosec + C.blsSign(sign.getPointer(), sec.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + return sign +} + +// Add -- +func (sign *Sign) Add(rhs *Sign) { + C.blsSignatureAdd(sign.getPointer(), rhs.getPointer()) +} + +// Recover -- +func (sign *Sign) Recover(signVec []Sign, idVec []ID) error { + // #nosec + return G1LagrangeInterpolation(&sign.v, *(*[]Fr)(unsafe.Pointer(&idVec)), *(*[]G1)(unsafe.Pointer(&signVec))) +} + +// Verify -- +func (sign *Sign) Verify(pub *PublicKey, m string) bool { + buf := []byte(m) + // #nosec + return C.blsVerify(sign.getPointer(), pub.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) == 1 +} + +// VerifyPop -- +func (sign *Sign) VerifyPop(pub *PublicKey) bool { + return C.blsVerifyPop(sign.getPointer(), pub.getPointer()) == 1 +} + +// MarshalJSON implements json.Marshaller. +func (sign *Sign) MarshalJSON() ([]byte, error) { + return json.Marshal(&struct { + Sign []byte `json:"sign"` + }{ + sign.Serialize(), + }) +} + +// UnmarshalJSON implements json.Unmarshaller. +func (sign *Sign) UnmarshalJSON(data []byte) error { + aux := &struct { + Sign []byte `json:"sign"` + }{} + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + if err := sign.Deserialize(aux.Sign); err != nil { + return err + } + return nil +} + +// DHKeyExchange -- +func DHKeyExchange(sec *SecretKey, pub *PublicKey) (out PublicKey) { + C.blsDHKeyExchange(out.getPointer(), sec.getPointer(), pub.getPointer()) + return out +} diff --git a/vendor/github.com/dexon-foundation/bls/ffi/go/bls/mcl.go b/vendor/github.com/dexon-foundation/bls/ffi/go/bls/mcl.go new file mode 100644 index 000000000..9771201ec --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/ffi/go/bls/mcl.go @@ -0,0 +1,632 @@ +package bls + +/* +#cgo CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 +#include <mcl/bn.h> +*/ +import "C" +import "fmt" +import "unsafe" + +// CurveFp254BNb -- 254 bit curve +const CurveFp254BNb = C.mclBn_CurveFp254BNb + +// CurveFp382_1 -- 382 bit curve 1 +const CurveFp382_1 = C.mclBn_CurveFp382_1 + +// CurveFp382_2 -- 382 bit curve 2 +const CurveFp382_2 = C.mclBn_CurveFp382_2 + +// BLS12_381 +const BLS12_381 = C.MCL_BLS12_381 + +// IoSerializeHexStr +const IoSerializeHexStr = C.MCLBN_IO_SERIALIZE_HEX_STR + +// GetMaxOpUnitSize -- +func GetMaxOpUnitSize() int { + return int(C.MCLBN_FP_UNIT_SIZE) +} + +// GetOpUnitSize -- +// the length of Fr is GetOpUnitSize() * 8 bytes +func GetOpUnitSize() int { + return int(C.mclBn_getOpUnitSize()) +} + +// GetCurveOrder -- +// return the order of G1 +func GetCurveOrder() string { + buf := make([]byte, 1024) + // #nosec + n := C.mclBn_getCurveOrder((*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))) + if n == 0 { + panic("implementation err. size of buf is small") + } + return string(buf[:n]) +} + +// GetFieldOrder -- +// return the characteristic of the field where a curve is defined +func GetFieldOrder() string { + buf := make([]byte, 1024) + // #nosec + n := C.mclBn_getFieldOrder((*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))) + if n == 0 { + panic("implementation err. size of buf is small") + } + return string(buf[:n]) +} + +// Fr -- +type Fr struct { + v C.mclBnFr +} + +// getPointer -- +func (x *Fr) getPointer() (p *C.mclBnFr) { + // #nosec + return (*C.mclBnFr)(unsafe.Pointer(x)) +} + +// Clear -- +func (x *Fr) Clear() { + // #nosec + C.mclBnFr_clear(x.getPointer()) +} + +// SetInt64 -- +func (x *Fr) SetInt64(v int64) { + // #nosec + C.mclBnFr_setInt(x.getPointer(), C.int64_t(v)) +} + +// SetString -- +func (x *Fr) SetString(s string, base int) error { + buf := []byte(s) + // #nosec + err := C.mclBnFr_setStr(x.getPointer(), (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), C.int(base)) + if err != 0 { + return fmt.Errorf("err mclBnFr_setStr %x", err) + } + return nil +} + +// Deserialize -- +func (x *Fr) Deserialize(buf []byte) error { + // #nosec + err := C.mclBnFr_deserialize(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err == 0 { + return fmt.Errorf("err mclBnFr_deserialize %x", buf) + } + return nil +} + +// SetLittleEndian -- +func (x *Fr) SetLittleEndian(buf []byte) error { + // #nosec + err := C.mclBnFr_setLittleEndian(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err != 0 { + return fmt.Errorf("err mclBnFr_setLittleEndian %x", err) + } + return nil +} + +// IsEqual -- +func (x *Fr) IsEqual(rhs *Fr) bool { + return C.mclBnFr_isEqual(x.getPointer(), rhs.getPointer()) == 1 +} + +// IsZero -- +func (x *Fr) IsZero() bool { + return C.mclBnFr_isZero(x.getPointer()) == 1 +} + +// IsOne -- +func (x *Fr) IsOne() bool { + return C.mclBnFr_isOne(x.getPointer()) == 1 +} + +// SetByCSPRNG -- +func (x *Fr) SetByCSPRNG() { + err := C.mclBnFr_setByCSPRNG(x.getPointer()) + if err != 0 { + panic("err mclBnFr_setByCSPRNG") + } +} + +// SetHashOf -- +func (x *Fr) SetHashOf(buf []byte) bool { + // #nosec + return C.mclBnFr_setHashOf(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) == 0 +} + +// GetString -- +func (x *Fr) GetString(base int) string { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnFr_getStr((*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), x.getPointer(), C.int(base)) + if n == 0 { + panic("err mclBnFr_getStr") + } + return string(buf[:n]) +} + +// Serialize -- +func (x *Fr) Serialize() []byte { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnFr_serialize(unsafe.Pointer(&buf[0]), C.size_t(len(buf)), x.getPointer()) + if n == 0 { + panic("err mclBnFr_serialize") + } + return buf[:n] +} + +// FrNeg -- +func FrNeg(out *Fr, x *Fr) { + C.mclBnFr_neg(out.getPointer(), x.getPointer()) +} + +// FrInv -- +func FrInv(out *Fr, x *Fr) { + C.mclBnFr_inv(out.getPointer(), x.getPointer()) +} + +// FrAdd -- +func FrAdd(out *Fr, x *Fr, y *Fr) { + C.mclBnFr_add(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// FrSub -- +func FrSub(out *Fr, x *Fr, y *Fr) { + C.mclBnFr_sub(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// FrMul -- +func FrMul(out *Fr, x *Fr, y *Fr) { + C.mclBnFr_mul(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// FrDiv -- +func FrDiv(out *Fr, x *Fr, y *Fr) { + C.mclBnFr_div(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// G1 -- +type G1 struct { + v C.mclBnG1 +} + +// getPointer -- +func (x *G1) getPointer() (p *C.mclBnG1) { + // #nosec + return (*C.mclBnG1)(unsafe.Pointer(x)) +} + +// Clear -- +func (x *G1) Clear() { + // #nosec + C.mclBnG1_clear(x.getPointer()) +} + +// SetString -- +func (x *G1) SetString(s string, base int) error { + buf := []byte(s) + // #nosec + err := C.mclBnG1_setStr(x.getPointer(), (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), C.int(base)) + if err != 0 { + return fmt.Errorf("err mclBnG1_setStr %x", err) + } + return nil +} + +// Deserialize -- +func (x *G1) Deserialize(buf []byte) error { + // #nosec + err := C.mclBnG1_deserialize(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err == 0 { + return fmt.Errorf("err mclBnG1_deserialize %x", buf) + } + return nil +} + +// IsEqual -- +func (x *G1) IsEqual(rhs *G1) bool { + return C.mclBnG1_isEqual(x.getPointer(), rhs.getPointer()) == 1 +} + +// IsZero -- +func (x *G1) IsZero() bool { + return C.mclBnG1_isZero(x.getPointer()) == 1 +} + +// HashAndMapTo -- +func (x *G1) HashAndMapTo(buf []byte) error { + // #nosec + err := C.mclBnG1_hashAndMapTo(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err != 0 { + return fmt.Errorf("err mclBnG1_hashAndMapTo %x", err) + } + return nil +} + +// GetString -- +func (x *G1) GetString(base int) string { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnG1_getStr((*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), x.getPointer(), C.int(base)) + if n == 0 { + panic("err mclBnG1_getStr") + } + return string(buf[:n]) +} + +// Serialize -- +func (x *G1) Serialize() []byte { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnG1_serialize(unsafe.Pointer(&buf[0]), C.size_t(len(buf)), x.getPointer()) + if n == 0 { + panic("err mclBnG1_serialize") + } + return buf[:n] +} + +// G1Neg -- +func G1Neg(out *G1, x *G1) { + C.mclBnG1_neg(out.getPointer(), x.getPointer()) +} + +// G1Dbl -- +func G1Dbl(out *G1, x *G1) { + C.mclBnG1_dbl(out.getPointer(), x.getPointer()) +} + +// G1Add -- +func G1Add(out *G1, x *G1, y *G1) { + C.mclBnG1_add(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// G1Sub -- +func G1Sub(out *G1, x *G1, y *G1) { + C.mclBnG1_sub(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// G1Mul -- +func G1Mul(out *G1, x *G1, y *Fr) { + C.mclBnG1_mul(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// G1MulCT -- constant time (depending on bit lengh of y) +func G1MulCT(out *G1, x *G1, y *Fr) { + C.mclBnG1_mulCT(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// G2 -- +type G2 struct { + v C.mclBnG2 +} + +// getPointer -- +func (x *G2) getPointer() (p *C.mclBnG2) { + // #nosec + return (*C.mclBnG2)(unsafe.Pointer(x)) +} + +// Clear -- +func (x *G2) Clear() { + // #nosec + C.mclBnG2_clear(x.getPointer()) +} + +// SetString -- +func (x *G2) SetString(s string, base int) error { + buf := []byte(s) + // #nosec + err := C.mclBnG2_setStr(x.getPointer(), (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), C.int(base)) + if err != 0 { + return fmt.Errorf("err mclBnG2_setStr %x", err) + } + return nil +} + +// Deserialize -- +func (x *G2) Deserialize(buf []byte) error { + // #nosec + err := C.mclBnG2_deserialize(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err == 0 { + return fmt.Errorf("err mclBnG2_deserialize %x", buf) + } + return nil +} + +// IsEqual -- +func (x *G2) IsEqual(rhs *G2) bool { + return C.mclBnG2_isEqual(x.getPointer(), rhs.getPointer()) == 1 +} + +// IsZero -- +func (x *G2) IsZero() bool { + return C.mclBnG2_isZero(x.getPointer()) == 1 +} + +// HashAndMapTo -- +func (x *G2) HashAndMapTo(buf []byte) error { + // #nosec + err := C.mclBnG2_hashAndMapTo(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err != 0 { + return fmt.Errorf("err mclBnG2_hashAndMapTo %x", err) + } + return nil +} + +// GetString -- +func (x *G2) GetString(base int) string { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnG2_getStr((*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), x.getPointer(), C.int(base)) + if n == 0 { + panic("err mclBnG2_getStr") + } + return string(buf[:n]) +} + +// Serialize -- +func (x *G2) Serialize() []byte { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnG2_serialize(unsafe.Pointer(&buf[0]), C.size_t(len(buf)), x.getPointer()) + if n == 0 { + panic("err mclBnG2_serialize") + } + return buf[:n] +} + +// G2Neg -- +func G2Neg(out *G2, x *G2) { + C.mclBnG2_neg(out.getPointer(), x.getPointer()) +} + +// G2Dbl -- +func G2Dbl(out *G2, x *G2) { + C.mclBnG2_dbl(out.getPointer(), x.getPointer()) +} + +// G2Add -- +func G2Add(out *G2, x *G2, y *G2) { + C.mclBnG2_add(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// G2Sub -- +func G2Sub(out *G2, x *G2, y *G2) { + C.mclBnG2_sub(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// G2Mul -- +func G2Mul(out *G2, x *G2, y *Fr) { + C.mclBnG2_mul(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// GT -- +type GT struct { + v C.mclBnGT +} + +// getPointer -- +func (x *GT) getPointer() (p *C.mclBnGT) { + // #nosec + return (*C.mclBnGT)(unsafe.Pointer(x)) +} + +// Clear -- +func (x *GT) Clear() { + // #nosec + C.mclBnGT_clear(x.getPointer()) +} + +// SetInt64 -- +func (x *GT) SetInt64(v int64) { + // #nosec + C.mclBnGT_setInt(x.getPointer(), C.int64_t(v)) +} + +// SetString -- +func (x *GT) SetString(s string, base int) error { + buf := []byte(s) + // #nosec + err := C.mclBnGT_setStr(x.getPointer(), (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), C.int(base)) + if err != 0 { + return fmt.Errorf("err mclBnGT_setStr %x", err) + } + return nil +} + +// Deserialize -- +func (x *GT) Deserialize(buf []byte) error { + // #nosec + err := C.mclBnGT_deserialize(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err == 0 { + return fmt.Errorf("err mclBnGT_deserialize %x", buf) + } + return nil +} + +// IsEqual -- +func (x *GT) IsEqual(rhs *GT) bool { + return C.mclBnGT_isEqual(x.getPointer(), rhs.getPointer()) == 1 +} + +// IsZero -- +func (x *GT) IsZero() bool { + return C.mclBnGT_isZero(x.getPointer()) == 1 +} + +// IsOne -- +func (x *GT) IsOne() bool { + return C.mclBnGT_isOne(x.getPointer()) == 1 +} + +// GetString -- +func (x *GT) GetString(base int) string { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnGT_getStr((*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)), x.getPointer(), C.int(base)) + if n == 0 { + panic("err mclBnGT_getStr") + } + return string(buf[:n]) +} + +// Serialize -- +func (x *GT) Serialize() []byte { + buf := make([]byte, 2048) + // #nosec + n := C.mclBnGT_serialize(unsafe.Pointer(&buf[0]), C.size_t(len(buf)), x.getPointer()) + if n == 0 { + panic("err mclBnGT_serialize") + } + return buf[:n] +} + +// GTNeg -- +func GTNeg(out *GT, x *GT) { + C.mclBnGT_neg(out.getPointer(), x.getPointer()) +} + +// GTInv -- +func GTInv(out *GT, x *GT) { + C.mclBnGT_inv(out.getPointer(), x.getPointer()) +} + +// GTAdd -- +func GTAdd(out *GT, x *GT, y *GT) { + C.mclBnGT_add(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// GTSub -- +func GTSub(out *GT, x *GT, y *GT) { + C.mclBnGT_sub(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// GTMul -- +func GTMul(out *GT, x *GT, y *GT) { + C.mclBnGT_mul(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// GTDiv -- +func GTDiv(out *GT, x *GT, y *GT) { + C.mclBnGT_div(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// GTPow -- +func GTPow(out *GT, x *GT, y *Fr) { + C.mclBnGT_pow(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// Pairing -- +func Pairing(out *GT, x *G1, y *G2) { + C.mclBn_pairing(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// FinalExp -- +func FinalExp(out *GT, x *GT) { + C.mclBn_finalExp(out.getPointer(), x.getPointer()) +} + +// MillerLoop -- +func MillerLoop(out *GT, x *G1, y *G2) { + C.mclBn_millerLoop(out.getPointer(), x.getPointer(), y.getPointer()) +} + +// GetUint64NumToPrecompute -- +func GetUint64NumToPrecompute() int { + return int(C.mclBn_getUint64NumToPrecompute()) +} + +// PrecomputeG2 -- +func PrecomputeG2(Qbuf []uint64, Q *G2) { + // #nosec + C.mclBn_precomputeG2((*C.uint64_t)(unsafe.Pointer(&Qbuf[0])), Q.getPointer()) +} + +// PrecomputedMillerLoop -- +func PrecomputedMillerLoop(out *GT, P *G1, Qbuf []uint64) { + // #nosec + C.mclBn_precomputedMillerLoop(out.getPointer(), P.getPointer(), (*C.uint64_t)(unsafe.Pointer(&Qbuf[0]))) +} + +// PrecomputedMillerLoop2 -- +func PrecomputedMillerLoop2(out *GT, P1 *G1, Q1buf []uint64, P2 *G1, Q2buf []uint64) { + // #nosec + C.mclBn_precomputedMillerLoop2(out.getPointer(), P1.getPointer(), (*C.uint64_t)(unsafe.Pointer(&Q1buf[0])), P1.getPointer(), (*C.uint64_t)(unsafe.Pointer(&Q1buf[0]))) +} + +// FrEvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ... +func FrEvaluatePolynomial(y *Fr, c []Fr, x *Fr) error { + // #nosec + err := C.mclBn_FrEvaluatePolynomial(y.getPointer(), (*C.mclBnFr)(unsafe.Pointer(&c[0])), (C.size_t)(len(c)), x.getPointer()) + if err != 0 { + return fmt.Errorf("err mclBn_FrEvaluatePolynomial") + } + return nil +} + +// G1EvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ... +func G1EvaluatePolynomial(y *G1, c []G1, x *Fr) error { + // #nosec + err := C.mclBn_G1EvaluatePolynomial(y.getPointer(), (*C.mclBnG1)(unsafe.Pointer(&c[0])), (C.size_t)(len(c)), x.getPointer()) + if err != 0 { + return fmt.Errorf("err mclBn_G1EvaluatePolynomial") + } + return nil +} + +// G2EvaluatePolynomial -- y = c[0] + c[1] * x + c[2] * x^2 + ... +func G2EvaluatePolynomial(y *G2, c []G2, x *Fr) error { + // #nosec + err := C.mclBn_G2EvaluatePolynomial(y.getPointer(), (*C.mclBnG2)(unsafe.Pointer(&c[0])), (C.size_t)(len(c)), x.getPointer()) + if err != 0 { + return fmt.Errorf("err mclBn_G2EvaluatePolynomial") + } + return nil +} + +// FrLagrangeInterpolation -- +func FrLagrangeInterpolation(out *Fr, xVec []Fr, yVec []Fr) error { + if len(xVec) != len(yVec) { + return fmt.Errorf("err FrLagrangeInterpolation:bad size") + } + // #nosec + err := C.mclBn_FrLagrangeInterpolation(out.getPointer(), (*C.mclBnFr)(unsafe.Pointer(&xVec[0])), (*C.mclBnFr)(unsafe.Pointer(&yVec[0])), (C.size_t)(len(xVec))) + if err != 0 { + return fmt.Errorf("err FrLagrangeInterpolation") + } + return nil +} + +// G1LagrangeInterpolation -- +func G1LagrangeInterpolation(out *G1, xVec []Fr, yVec []G1) error { + if len(xVec) != len(yVec) { + return fmt.Errorf("err G1LagrangeInterpolation:bad size") + } + // #nosec + err := C.mclBn_G1LagrangeInterpolation(out.getPointer(), (*C.mclBnFr)(unsafe.Pointer(&xVec[0])), (*C.mclBnG1)(unsafe.Pointer(&yVec[0])), (C.size_t)(len(xVec))) + if err != 0 { + return fmt.Errorf("err G1LagrangeInterpolation") + } + return nil +} + +// G2LagrangeInterpolation -- +func G2LagrangeInterpolation(out *G2, xVec []Fr, yVec []G2) error { + if len(xVec) != len(yVec) { + return fmt.Errorf("err G2LagrangeInterpolation:bad size") + } + // #nosec + err := C.mclBn_G2LagrangeInterpolation(out.getPointer(), (*C.mclBnFr)(unsafe.Pointer(&xVec[0])), (*C.mclBnG2)(unsafe.Pointer(&yVec[0])), (C.size_t)(len(xVec))) + if err != 0 { + return fmt.Errorf("err G2LagrangeInterpolation") + } + return nil +} diff --git a/vendor/github.com/dexon-foundation/bls/include/bls/bls.h b/vendor/github.com/dexon-foundation/bls/include/bls/bls.h new file mode 100644 index 000000000..6b7cbdd68 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/include/bls/bls.h @@ -0,0 +1,230 @@ +#pragma once +/** + @file + @brief C interface of bls.hpp + @author MITSUNARI Shigeo(@herumi) + @license modified new BSD license + http://opensource.org/licenses/BSD-3-Clause +*/ +#include <mcl/bn.h> + +#ifdef _MSC_VER + #ifdef BLS_DONT_EXPORT + #define BLS_DLL_API + #else + #ifdef BLS_DLL_EXPORT + #define BLS_DLL_API __declspec(dllexport) + #else + #define BLS_DLL_API __declspec(dllimport) + #endif + #endif + #ifndef BLS_NO_AUTOLINK + #if MCLBN_FP_UNIT_SIZE == 4 + #pragma comment(lib, "bls256.lib") + #elif MCLBN_FP_UNIT_SIZE == 6 + #pragma comment(lib, "bls384.lib") + #endif + #endif +#elif defined(__EMSCRIPTEN__) && !defined(BLS_DONT_EXPORT) + #define BLS_DLL_API __attribute__((used)) +#elif defined(__wasm__) && !defined(BLS_DONT_EXPORT) + #define BLS_DLL_API __attribute__((visibility("default"))) +#else + #define BLS_DLL_API +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + mclBnFr v; +} blsId; + +typedef struct { + mclBnFr v; +} blsSecretKey; + +typedef struct { + mclBnG2 v; +} blsPublicKey; + +typedef struct { + mclBnG1 v; +} blsSignature; + +/* + initialize this library + call this once before using the other functions + @param curve [in] enum value defined in mcl/bn.h + @param compiledTimeVar [in] specify MCLBN_COMPILED_TIME_VAR, + which macro is used to make sure that the values + are the same when the library is built and used + @return 0 if success + @note blsInit() is thread safe and serialized if it is called simultaneously + but don't call it while using other functions. +*/ +BLS_DLL_API int blsInit(int curve, int compiledTimeVar); + +BLS_DLL_API void blsIdSetInt(blsId *id, int x); + +// return 0 if success +// mask buf with (1 << (bitLen(r) - 1)) - 1 if buf >= r +BLS_DLL_API int blsSecretKeySetLittleEndian(blsSecretKey *sec, const void *buf, mclSize bufSize); + +BLS_DLL_API void blsGetPublicKey(blsPublicKey *pub, const blsSecretKey *sec); + +// calculate the has of m and sign the hash +BLS_DLL_API void blsSign(blsSignature *sig, const blsSecretKey *sec, const void *m, mclSize size); + +// return 1 if valid +BLS_DLL_API int blsVerify(const blsSignature *sig, const blsPublicKey *pub, const void *m, mclSize size); + +// return written byte size if success else 0 +BLS_DLL_API mclSize blsIdSerialize(void *buf, mclSize maxBufSize, const blsId *id); +BLS_DLL_API mclSize blsSecretKeySerialize(void *buf, mclSize maxBufSize, const blsSecretKey *sec); +BLS_DLL_API mclSize blsPublicKeySerialize(void *buf, mclSize maxBufSize, const blsPublicKey *pub); +BLS_DLL_API mclSize blsSignatureSerialize(void *buf, mclSize maxBufSize, const blsSignature *sig); + +// return read byte size if success else 0 +BLS_DLL_API mclSize blsIdDeserialize(blsId *id, const void *buf, mclSize bufSize); +BLS_DLL_API mclSize blsSecretKeyDeserialize(blsSecretKey *sec, const void *buf, mclSize bufSize); +BLS_DLL_API mclSize blsPublicKeyDeserialize(blsPublicKey *pub, const void *buf, mclSize bufSize); +BLS_DLL_API mclSize blsSignatureDeserialize(blsSignature *sig, const void *buf, mclSize bufSize); + +// return 1 if same else 0 +BLS_DLL_API int blsIdIsEqual(const blsId *lhs, const blsId *rhs); +BLS_DLL_API int blsSecretKeyIsEqual(const blsSecretKey *lhs, const blsSecretKey *rhs); +BLS_DLL_API int blsPublicKeyIsEqual(const blsPublicKey *lhs, const blsPublicKey *rhs); +BLS_DLL_API int blsSignatureIsEqual(const blsSignature *lhs, const blsSignature *rhs); + +// return 0 if success +BLS_DLL_API int blsSecretKeyShare(blsSecretKey *sec, const blsSecretKey* msk, mclSize k, const blsId *id); +BLS_DLL_API int blsPublicKeyShare(blsPublicKey *pub, const blsPublicKey *mpk, mclSize k, const blsId *id); + +BLS_DLL_API int blsSecretKeyRecover(blsSecretKey *sec, const blsSecretKey *secVec, const blsId *idVec, mclSize n); +BLS_DLL_API int blsPublicKeyRecover(blsPublicKey *pub, const blsPublicKey *pubVec, const blsId *idVec, mclSize n); +BLS_DLL_API int blsSignatureRecover(blsSignature *sig, const blsSignature *sigVec, const blsId *idVec, mclSize n); + +// add +BLS_DLL_API void blsSecretKeyAdd(blsSecretKey *sec, const blsSecretKey *rhs); +BLS_DLL_API void blsPublicKeyAdd(blsPublicKey *pub, const blsPublicKey *rhs); +BLS_DLL_API void blsSignatureAdd(blsSignature *sig, const blsSignature *rhs); + +/* + verify whether a point of an elliptic curve has order r + This api affetcs setStr(), deserialize() for G2 on BN or G1/G2 on BLS12 + @param doVerify [in] does not verify if zero(default 1) + Signature = G1, PublicKey = G2 +*/ +BLS_DLL_API void blsSignatureVerifyOrder(int doVerify); +BLS_DLL_API void blsPublicKeyVerifyOrder(int doVerify); +// deserialize under VerifyOrder(true) = deserialize under VerifyOrder(false) + IsValidOrder +BLS_DLL_API int blsSignatureIsValidOrder(const blsSignature *sig); +BLS_DLL_API int blsPublicKeyIsValidOrder(const blsPublicKey *pub); + +#ifndef BLS_MINIMUM_API + +/* + sign the hash + use the low (bitSize of r) - 1 bit of h + return 0 if success else -1 + NOTE : return false if h is zero or c1 or -c1 value for BN254. see hashTest() in test/bls_test.hpp +*/ +BLS_DLL_API int blsSignHash(blsSignature *sig, const blsSecretKey *sec, const void *h, mclSize size); +// return 1 if valid +BLS_DLL_API int blsVerifyHash(const blsSignature *sig, const blsPublicKey *pub, const void *h, mclSize size); + +/* + verify aggSig with pubVec[0, n) and hVec[0, n) + e(aggSig, Q) = prod_i e(hVec[i], pubVec[i]) + return 1 if valid + @note do not check duplication of hVec +*/ +BLS_DLL_API int blsVerifyAggregatedHashes(const blsSignature *aggSig, const blsPublicKey *pubVec, const void *hVec, size_t sizeofHash, mclSize n); + +// sub +BLS_DLL_API void blsSecretKeySub(blsSecretKey *sec, const blsSecretKey *rhs); +BLS_DLL_API void blsPublicKeySub(blsPublicKey *pub, const blsPublicKey *rhs); +BLS_DLL_API void blsSignatureSub(blsSignature *sig, const blsSignature *rhs); + +// not thread safe version (old blsInit) +BLS_DLL_API int blsInitNotThreadSafe(int curve, int compiledTimeVar); + +BLS_DLL_API mclSize blsGetOpUnitSize(void); +// return strlen(buf) if success else 0 +BLS_DLL_API int blsGetCurveOrder(char *buf, mclSize maxBufSize); +BLS_DLL_API int blsGetFieldOrder(char *buf, mclSize maxBufSize); + +// return bytes for serialized G1(=Fp) +BLS_DLL_API int blsGetG1ByteSize(void); + +// return bytes for serialized Fr +BLS_DLL_API int blsGetFrByteSize(void); + +// get a generator of G2 +BLS_DLL_API void blsGetGeneratorOfG2(blsPublicKey *pub); + +// return 0 if success +BLS_DLL_API int blsIdSetDecStr(blsId *id, const char *buf, mclSize bufSize); +BLS_DLL_API int blsIdSetHexStr(blsId *id, const char *buf, mclSize bufSize); + +/* + return strlen(buf) if success else 0 + buf is '\0' terminated +*/ +BLS_DLL_API mclSize blsIdGetDecStr(char *buf, mclSize maxBufSize, const blsId *id); +BLS_DLL_API mclSize blsIdGetHexStr(char *buf, mclSize maxBufSize, const blsId *id); + +// hash buf and set +BLS_DLL_API int blsHashToSecretKey(blsSecretKey *sec, const void *buf, mclSize bufSize); +#ifndef MCL_DONT_USE_CSPRNG +/* + set secretKey if system has /dev/urandom or CryptGenRandom + return 0 if success else -1 +*/ +BLS_DLL_API int blsSecretKeySetByCSPRNG(blsSecretKey *sec); +#endif + +BLS_DLL_API void blsGetPop(blsSignature *sig, const blsSecretKey *sec); + +BLS_DLL_API int blsVerifyPop(const blsSignature *sig, const blsPublicKey *pub); +////////////////////////////////////////////////////////////////////////// +// the following apis will be removed + +// mask buf with (1 << (bitLen(r) - 1)) - 1 if buf >= r +BLS_DLL_API int blsIdSetLittleEndian(blsId *id, const void *buf, mclSize bufSize); +/* + return written byte size if success else 0 +*/ +BLS_DLL_API mclSize blsIdGetLittleEndian(void *buf, mclSize maxBufSize, const blsId *id); + +// return 0 if success +BLS_DLL_API int blsSecretKeySetDecStr(blsSecretKey *sec, const char *buf, mclSize bufSize); +BLS_DLL_API int blsSecretKeySetHexStr(blsSecretKey *sec, const char *buf, mclSize bufSize); +/* + return written byte size if success else 0 +*/ +BLS_DLL_API mclSize blsSecretKeyGetLittleEndian(void *buf, mclSize maxBufSize, const blsSecretKey *sec); +/* + return strlen(buf) if success else 0 + buf is '\0' terminated +*/ +BLS_DLL_API mclSize blsSecretKeyGetDecStr(char *buf, mclSize maxBufSize, const blsSecretKey *sec); +BLS_DLL_API mclSize blsSecretKeyGetHexStr(char *buf, mclSize maxBufSize, const blsSecretKey *sec); +BLS_DLL_API int blsPublicKeySetHexStr(blsPublicKey *pub, const char *buf, mclSize bufSize); +BLS_DLL_API mclSize blsPublicKeyGetHexStr(char *buf, mclSize maxBufSize, const blsPublicKey *pub); +BLS_DLL_API int blsSignatureSetHexStr(blsSignature *sig, const char *buf, mclSize bufSize); +BLS_DLL_API mclSize blsSignatureGetHexStr(char *buf, mclSize maxBufSize, const blsSignature *sig); + +/* + Diffie Hellman key exchange + out = sec * pub +*/ +BLS_DLL_API void blsDHKeyExchange(blsPublicKey *out, const blsSecretKey *sec, const blsPublicKey *pub); + +#endif // BLS_MINIMUM_API + +#ifdef __cplusplus +} +#endif diff --git a/vendor/github.com/dexon-foundation/bls/include/bls/bls.hpp b/vendor/github.com/dexon-foundation/bls/include/bls/bls.hpp new file mode 100644 index 000000000..b32b7e1fa --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/include/bls/bls.hpp @@ -0,0 +1,508 @@ +#pragma once +/** + @file + @brief BLS threshold signature on BN curve + @author MITSUNARI Shigeo(@herumi) + @license modified new BSD license + http://opensource.org/licenses/BSD-3-Clause +*/ +#include <bls/bls.h> +#include <stdexcept> +#include <vector> +#include <string> +#include <iosfwd> +#include <stdint.h> + +namespace bls { + +// same value with IoMode of mcl/op.hpp +enum { + IoBin = 2, // binary number + IoDec = 10, // decimal number + IoHex = 16, // hexadecimal number + IoPrefix = 128, // append '0b'(bin) or '0x'(hex) + IoSerialize = 512, + IoFixedByteSeq = IoSerialize // fixed byte representation +}; + +/* + BLS signature + e : G2 x G1 -> Fp12 + Q in G2 ; fixed global parameter + H : {str} -> G1 + s : secret key + sQ ; public key + s H(m) ; signature of m + verify ; e(sQ, H(m)) = e(Q, s H(m)) +*/ + +/* + initialize this library + call this once before using the other method + @param curve [in] type of curve + @param compiledTimevar [in] use the default value + @note init() is not thread safe +*/ +inline void init(int curve = mclBn_CurveFp254BNb, int compiledTimeVar = MCLBN_COMPILED_TIME_VAR) +{ + if (blsInit(curve, compiledTimeVar) != 0) throw std::invalid_argument("blsInit"); +} +inline size_t getOpUnitSize() { return blsGetOpUnitSize(); } + +inline void getCurveOrder(std::string& str) +{ + str.resize(1024); + mclSize n = blsGetCurveOrder(&str[0], str.size()); + if (n == 0) throw std::runtime_error("blsGetCurveOrder"); + str.resize(n); +} +inline void getFieldOrder(std::string& str) +{ + str.resize(1024); + mclSize n = blsGetFieldOrder(&str[0], str.size()); + if (n == 0) throw std::runtime_error("blsGetFieldOrder"); + str.resize(n); +} +inline int getG1ByteSize() { return blsGetG1ByteSize(); } +inline int getFrByteSize() { return blsGetFrByteSize(); } + +namespace local { +/* + the value of secretKey and Id must be less than + r = 0x2523648240000001ba344d8000000007ff9f800000000010a10000000000000d + sizeof(uint64_t) * keySize byte +*/ +const size_t keySize = MCLBN_FP_UNIT_SIZE; +} + +class SecretKey; +class PublicKey; +class Signature; +class Id; + +typedef std::vector<SecretKey> SecretKeyVec; +typedef std::vector<PublicKey> PublicKeyVec; +typedef std::vector<Signature> SignatureVec; +typedef std::vector<Id> IdVec; + +class Id { + blsId self_; + friend class PublicKey; + friend class SecretKey; + friend class Signature; +public: + Id(unsigned int id = 0) + { + blsIdSetInt(&self_, id); + } + bool operator==(const Id& rhs) const + { + return blsIdIsEqual(&self_, &rhs.self_) == 1; + } + bool operator!=(const Id& rhs) const { return !(*this == rhs); } + friend std::ostream& operator<<(std::ostream& os, const Id& id) + { + std::string str; + id.getStr(str, 16|IoPrefix); + return os << str; + } + friend std::istream& operator>>(std::istream& is, Id& id) + { + std::string str; + is >> str; + id.setStr(str, 16); + return is; + } + void getStr(std::string& str, int ioMode = 0) const + { + str.resize(1024); + size_t n = mclBnFr_getStr(&str[0], str.size(), &self_.v, ioMode); + if (n == 0) throw std::runtime_error("mclBnFr_getStr"); + str.resize(n); + } + void setStr(const std::string& str, int ioMode = 0) + { + int ret = mclBnFr_setStr(&self_.v, str.c_str(), str.size(), ioMode); + if (ret != 0) throw std::runtime_error("mclBnFr_setStr"); + } + bool isZero() const + { + return mclBnFr_isZero(&self_.v) == 1; + } + /* + set p[0, .., keySize) + @note the value must be less than r + */ + void set(const uint64_t *p) + { + setLittleEndian(p, local::keySize * sizeof(uint64_t)); + } + // bufSize is truncted/zero extended to keySize + void setLittleEndian(const void *buf, size_t bufSize) + { + mclBnFr_setLittleEndian(&self_.v, buf, bufSize); + } +}; + +/* + s ; secret key +*/ +class SecretKey { + blsSecretKey self_; +public: + bool operator==(const SecretKey& rhs) const + { + return blsSecretKeyIsEqual(&self_, &rhs.self_) == 1; + } + bool operator!=(const SecretKey& rhs) const { return !(*this == rhs); } + friend std::ostream& operator<<(std::ostream& os, const SecretKey& sec) + { + std::string str; + sec.getStr(str, 16|IoPrefix); + return os << str; + } + friend std::istream& operator>>(std::istream& is, SecretKey& sec) + { + std::string str; + is >> str; + sec.setStr(str); + return is; + } + void getStr(std::string& str, int ioMode = 0) const + { + str.resize(1024); + size_t n = mclBnFr_getStr(&str[0], str.size(), &self_.v, ioMode); + if (n == 0) throw std::runtime_error("mclBnFr_getStr"); + str.resize(n); + } + void setStr(const std::string& str, int ioMode = 0) + { + int ret = mclBnFr_setStr(&self_.v, str.c_str(), str.size(), ioMode); + if (ret != 0) throw std::runtime_error("mclBnFr_setStr"); + } + /* + initialize secretKey with random number + */ + void init() + { + int ret = blsSecretKeySetByCSPRNG(&self_); + if (ret != 0) throw std::runtime_error("blsSecretKeySetByCSPRNG"); + } + /* + set secretKey with p[0, .., keySize) and set id = 0 + @note the value must be less than r + */ + void set(const uint64_t *p) + { + setLittleEndian(p, local::keySize * sizeof(uint64_t)); + } + // bufSize is truncted/zero extended to keySize + void setLittleEndian(const void *buf, size_t bufSize) + { + mclBnFr_setLittleEndian(&self_.v, buf, bufSize); + } + // set hash of buf + void setHashOf(const void *buf, size_t bufSize) + { + int ret = mclBnFr_setHashOf(&self_.v, buf, bufSize); + if (ret != 0) throw std::runtime_error("mclBnFr_setHashOf"); + } + void getPublicKey(PublicKey& pub) const; + // constant time sign + // sign hash(m) + void sign(Signature& sig, const void *m, size_t size) const; + void sign(Signature& sig, const std::string& m) const + { + sign(sig, m.c_str(), m.size()); + } + // sign hashed value + void signHash(Signature& sig, const void *h, size_t size) const; + void signHash(Signature& sig, const std::string& h) const + { + signHash(sig, h.c_str(), h.size()); + } + /* + make Pop(Proof of Possesion) + pop = prv.sign(pub) + */ + void getPop(Signature& pop) const; + /* + make [s_0, ..., s_{k-1}] to prepare k-out-of-n secret sharing + */ + void getMasterSecretKey(SecretKeyVec& msk, size_t k) const + { + if (k <= 1) throw std::invalid_argument("getMasterSecretKey"); + msk.resize(k); + msk[0] = *this; + for (size_t i = 1; i < k; i++) { + msk[i].init(); + } + } + /* + set a secret key for id > 0 from msk + */ + void set(const SecretKeyVec& msk, const Id& id) + { + set(msk.data(), msk.size(), id); + } + /* + recover secretKey from k secVec + */ + void recover(const SecretKeyVec& secVec, const IdVec& idVec) + { + if (secVec.size() != idVec.size()) throw std::invalid_argument("SecretKey::recover"); + recover(secVec.data(), idVec.data(), idVec.size()); + } + /* + add secret key + */ + void add(const SecretKey& rhs); + + // the following methods are for C api + /* + the size of msk must be k + */ + void set(const SecretKey *msk, size_t k, const Id& id) + { + int ret = blsSecretKeyShare(&self_, &msk->self_, k, &id.self_); + if (ret != 0) throw std::runtime_error("blsSecretKeyShare"); + } + void recover(const SecretKey *secVec, const Id *idVec, size_t n) + { + int ret = blsSecretKeyRecover(&self_, &secVec->self_, &idVec->self_, n); + if (ret != 0) throw std::runtime_error("blsSecretKeyRecover:same id"); + } +}; + +/* + sQ ; public key +*/ +class PublicKey { + blsPublicKey self_; + friend class SecretKey; + friend class Signature; +public: + bool operator==(const PublicKey& rhs) const + { + return blsPublicKeyIsEqual(&self_, &rhs.self_) == 1; + } + bool operator!=(const PublicKey& rhs) const { return !(*this == rhs); } + friend std::ostream& operator<<(std::ostream& os, const PublicKey& pub) + { + std::string str; + pub.getStr(str, 16|IoPrefix); + return os << str; + } + friend std::istream& operator>>(std::istream& is, PublicKey& pub) + { + std::string str; + is >> str; + if (str != "0") { + // 1 <x.a> <x.b> <y.a> <y.b> + std::string t; + for (int i = 0; i < 4; i++) { + is >> t; + str += ' '; + str += t; + } + } + pub.setStr(str, 16); + return is; + } + void getStr(std::string& str, int ioMode = 0) const + { + str.resize(1024); + size_t n = mclBnG2_getStr(&str[0], str.size(), &self_.v, ioMode); + if (n == 0) throw std::runtime_error("mclBnG2_getStr"); + str.resize(n); + } + void setStr(const std::string& str, int ioMode = 0) + { + int ret = mclBnG2_setStr(&self_.v, str.c_str(), str.size(), ioMode); + if (ret != 0) throw std::runtime_error("mclBnG2_setStr"); + } + /* + set public for id from mpk + */ + void set(const PublicKeyVec& mpk, const Id& id) + { + set(mpk.data(), mpk.size(), id); + } + /* + recover publicKey from k pubVec + */ + void recover(const PublicKeyVec& pubVec, const IdVec& idVec) + { + if (pubVec.size() != idVec.size()) throw std::invalid_argument("PublicKey::recover"); + recover(pubVec.data(), idVec.data(), idVec.size()); + } + /* + add public key + */ + void add(const PublicKey& rhs) + { + blsPublicKeyAdd(&self_, &rhs.self_); + } + + // the following methods are for C api + void set(const PublicKey *mpk, size_t k, const Id& id) + { + int ret = blsPublicKeyShare(&self_, &mpk->self_, k, &id.self_); + if (ret != 0) throw std::runtime_error("blsPublicKeyShare"); + } + void recover(const PublicKey *pubVec, const Id *idVec, size_t n) + { + int ret = blsPublicKeyRecover(&self_, &pubVec->self_, &idVec->self_, n); + if (ret != 0) throw std::runtime_error("blsPublicKeyRecover"); + } +}; + +/* + s H(m) ; signature +*/ +class Signature { + blsSignature self_; + friend class SecretKey; +public: + bool operator==(const Signature& rhs) const + { + return blsSignatureIsEqual(&self_, &rhs.self_) == 1; + } + bool operator!=(const Signature& rhs) const { return !(*this == rhs); } + friend std::ostream& operator<<(std::ostream& os, const Signature& sig) + { + std::string str; + sig.getStr(str, 16|IoPrefix); + return os << str; + } + friend std::istream& operator>>(std::istream& is, Signature& sig) + { + std::string str; + is >> str; + if (str != "0") { + // 1 <x> <y> + std::string t; + for (int i = 0; i < 2; i++) { + is >> t; + str += ' '; + str += t; + } + } + sig.setStr(str, 16); + return is; + } + void getStr(std::string& str, int ioMode = 0) const + { + str.resize(1024); + size_t n = mclBnG1_getStr(&str[0], str.size(), &self_.v, ioMode); + if (n == 0) throw std::runtime_error("mclBnG1_getStr"); + str.resize(n); + } + void setStr(const std::string& str, int ioMode = 0) + { + int ret = mclBnG1_setStr(&self_.v, str.c_str(), str.size(), ioMode); + if (ret != 0) throw std::runtime_error("mclBnG1_setStr"); + } + bool verify(const PublicKey& pub, const void *m, size_t size) const + { + return blsVerify(&self_, &pub.self_, m, size) == 1; + } + bool verify(const PublicKey& pub, const std::string& m) const + { + return verify(pub, m.c_str(), m.size()); + } + bool verifyHash(const PublicKey& pub, const void *h, size_t size) const + { + return blsVerifyHash(&self_, &pub.self_, h, size) == 1; + } + bool verifyHash(const PublicKey& pub, const std::string& h) const + { + return verifyHash(pub, h.c_str(), h.size()); + } + bool verifyAggregatedHashes(const PublicKey *pubVec, const void *hVec, size_t sizeofHash, size_t n) const + { + return blsVerifyAggregatedHashes(&self_, &pubVec[0].self_, hVec, sizeofHash, n) == 1; + } + /* + verify self(pop) with pub + */ + bool verify(const PublicKey& pub) const + { + std::string str; + pub.getStr(str); + return verify(pub, str); + } + /* + recover sig from k sigVec + */ + void recover(const SignatureVec& sigVec, const IdVec& idVec) + { + if (sigVec.size() != idVec.size()) throw std::invalid_argument("Signature::recover"); + recover(sigVec.data(), idVec.data(), idVec.size()); + } + /* + add signature + */ + void add(const Signature& rhs) + { + blsSignatureAdd(&self_, &rhs.self_); + } + + // the following methods are for C api + void recover(const Signature* sigVec, const Id *idVec, size_t n) + { + int ret = blsSignatureRecover(&self_, &sigVec->self_, &idVec->self_, n); + if (ret != 0) throw std::runtime_error("blsSignatureRecover:same id"); + } +}; + +/* + make master public key [s_0 Q, ..., s_{k-1} Q] from msk +*/ +inline void getMasterPublicKey(PublicKeyVec& mpk, const SecretKeyVec& msk) +{ + const size_t n = msk.size(); + mpk.resize(n); + for (size_t i = 0; i < n; i++) { + msk[i].getPublicKey(mpk[i]); + } +} + +inline void SecretKey::getPublicKey(PublicKey& pub) const +{ + blsGetPublicKey(&pub.self_, &self_); +} +inline void SecretKey::sign(Signature& sig, const void *m, size_t size) const +{ + blsSign(&sig.self_, &self_, m, size); +} +inline void SecretKey::signHash(Signature& sig, const void *h, size_t size) const +{ + if (blsSignHash(&sig.self_, &self_, h, size) != 0) throw std::runtime_error("bad h"); +} +inline void SecretKey::getPop(Signature& pop) const +{ + PublicKey pub; + getPublicKey(pub); + std::string m; + pub.getStr(m); + sign(pop, m); +} + +/* + make pop from msk and mpk +*/ +inline void getPopVec(SignatureVec& popVec, const SecretKeyVec& msk) +{ + const size_t n = msk.size(); + popVec.resize(n); + for (size_t i = 0; i < n; i++) { + msk[i].getPop(popVec[i]); + } +} + +inline Signature operator+(const Signature& a, const Signature& b) { Signature r(a); r.add(b); return r; } +inline PublicKey operator+(const PublicKey& a, const PublicKey& b) { PublicKey r(a); r.add(b); return r; } +inline SecretKey operator+(const SecretKey& a, const SecretKey& b) { SecretKey r(a); r.add(b); return r; } + +} //bls diff --git a/vendor/github.com/dexon-foundation/bls/lib/.emptydir b/vendor/github.com/dexon-foundation/bls/lib/.emptydir new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/lib/.emptydir diff --git a/vendor/github.com/dexon-foundation/bls/mk.bat b/vendor/github.com/dexon-foundation/bls/mk.bat new file mode 100644 index 000000000..c5dfac91a --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/mk.bat @@ -0,0 +1,19 @@ +@echo off +if "%1"=="-s" ( + echo use static lib + set CFLAGS=%CFLAGS% /DMCLBN_NO_AUTOLINK /DBLS_DONT_EXPORT +) else if "%1"=="-d" ( + echo use dynamic lib +) else ( + echo "mk (-s|-d) <source file>" + goto exit +) +set SRC=%2 +set EXE=%SRC:.cpp=.exe% +set EXE=%EXE:.c=.exe% +set EXE=%EXE:test\=bin\% +set EXE=%EXE:sample\=bin\% +echo cl %CFLAGS% %2 /Fe:%EXE% /link %LDFLAGS% +cl %CFLAGS% %2 /Fe:%EXE% /link %LDFLAGS% + +:exit diff --git a/vendor/github.com/dexon-foundation/bls/mkdll.bat b/vendor/github.com/dexon-foundation/bls/mkdll.bat new file mode 100755 index 000000000..17e934f92 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/mkdll.bat @@ -0,0 +1,8 @@ +rem @echo off + +call setvar.bat dll +echo make bls384.dll +cl /c %CFLAGS% /DBLS_NO_AUTOLINK /Foobj/bls_c.obj src/bls_c.cpp +cl /c %CFLAGS% /DBLS_NO_AUTOLINK /Foobj/fp.obj ../mcl/src/fp.cpp +lib /OUT:lib/bls384.lib /nodefaultlib obj/bls_c.obj obj/fp.obj %LDFLAGS% +cl /LD /MT obj/bls_c.obj obj/fp.obj %CFLAGS% /link /out:bin/bls384.dll %LDFLAGS% diff --git a/vendor/github.com/dexon-foundation/bls/mklib.bat b/vendor/github.com/dexon-foundation/bls/mklib.bat new file mode 100644 index 000000000..fca9333fc --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/mklib.bat @@ -0,0 +1,22 @@ +@echo off +call ..\mcl\setvar.bat +if "%1"=="dll" ( + echo make dynamic library DLL +) else ( + echo make static library LIB +) +call setvar.bat + +if "%1"=="dll" ( + cl /c %CFLAGS% /Foobj/bls_c256.obj src/bls_c256.cpp /DBLS_NO_AUTOLINK + cl /c %CFLAGS% /Foobj/bls_c384.obj src/bls_c384.cpp /DBLS_NO_AUTOLINK + cl /c %CFLAGS% /Foobj/fp.obj ../mcl/src/fp.cpp + link /nologo /DLL /OUT:bin\bls256.dll obj\bls_c256.obj obj\fp.obj %LDFLAGS% /implib:lib\bls256.lib + link /nologo /DLL /OUT:bin\bls384.dll obj\bls_c384.obj obj\fp.obj %LDFLAGS% /implib:lib\bls384.lib +) else ( + cl /c %CFLAGS% /Foobj/bls_c256.obj src/bls_c256.cpp + cl /c %CFLAGS% /Foobj/bls_c384.obj src/bls_c384.cpp + cl /c %CFLAGS% /Foobj/fp.obj ../mcl/src/fp.cpp /DMCLBN_DONT_EXPORT + lib /OUT:lib/bls256.lib /nodefaultlib obj/bls_c256.obj obj/fp.obj %LDFLAGS% + lib /OUT:lib/bls384.lib /nodefaultlib obj/bls_c384.obj obj/fp.obj %LDFLAGS% +) diff --git a/vendor/github.com/dexon-foundation/bls/obj/.emptydir b/vendor/github.com/dexon-foundation/bls/obj/.emptydir new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/obj/.emptydir diff --git a/vendor/github.com/dexon-foundation/bls/readme.md b/vendor/github.com/dexon-foundation/bls/readme.md new file mode 100644 index 000000000..544fee3ca --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/readme.md @@ -0,0 +1,170 @@ +[](https://travis-ci.com/Spiderpowa/bls) + +# BLS threshold signature + +An implementation of BLS threshold signature + +# Installation Requirements + +Create a working directory (e.g., work) and clone the following repositories. +``` +mkdir work +cd work +git clone git://github.com/herumi/mcl.git +git clone git://github.com/herumi/bls.git +git clone git://github.com/herumi/cybozulib_ext ; for only Windows +``` + +# **REMARK** libbls.a for C++ interface(bls/bls.hpp) is removed +Link `lib/libbls256.a` or `lib/libbls384.a` to use `bls/bls.hpp` according to MCLBN_FP_UNIT_SIZE = 4 or 6. + +# Build and test for Linux +To make and test, run +``` +cd bls +make test +``` +To make sample programs, run +``` +make sample_test +``` + +# Build and test for Windows +1) make static library and use it +``` +mklib +mk -s test\bls_c384_test.cpp +bin\bls_c384_test.exe +``` + +2) make dynamic library and use it +``` +mklib dll +mk -d test\bls_c384_test.cpp +bin\bls_c384_test.exe +``` + +# Library +* libbls256.a/libbls256_dy.so ; for BN254 compiled with MCLBN_FP_UNIT_SIZE=4 +* libbls384.a/libbls384_dy.so ; for BN254/BN381_1/BLS12_381 compiled with MCLBN_FP_UNIT_SIZE=6 + +See `mcl/include/curve_type.h` for curve parameter + +# API + +## Basic API + +BLS signature +``` +e : G2 x G1 -> Fp12 ; optimal ate pairing over BN curve +Q in G2 ; fixed global parameter +H : {str} -> G1 +s in Fr: secret key +sQ in G2; public key +s H(m) in G1; signature of m +verify ; e(sQ, H(m)) = e(Q, s H(m)) +``` + +``` +void bls::init(); +``` + +Initialize this library. Call this once to use the other api. + +``` +void SecretKey::init(); +``` + +Initialize the instance of SecretKey. `s` is a random number. + +``` +void SecretKey::getPublicKey(PublicKey& pub) const; +``` + +Get public key `sQ` for the secret key `s`. + +``` +void SecretKey::sign(Sign& sign, const std::string& m) const; +``` + +Make sign `s H(m)` from message m. + +``` +bool Sign::verify(const PublicKey& pub, const std::string& m) const; +``` + +Verify sign with pub and m and return true if it is valid. + +``` +e(sQ, H(m)) == e(Q, s H(m)) +``` + +### Secret Sharing API + +``` +void SecretKey::getMasterSecretKey(SecretKeyVec& msk, size_t k) const; +``` + +Prepare k-out-of-n secret sharing for the secret key. +`msk[0]` is the original secret key `s` and `msk[i]` for i > 0 are random secret key. + +``` +void SecretKey::set(const SecretKeyVec& msk, const Id& id); +``` + +Make secret key f(id) from msk and id where f(x) = msk[0] + msk[1] x + ... + msk[k-1] x^{k-1}. + +You can make a public key `f(id)Q` from each secret key f(id) for id != 0 and sign a message. + +``` +void Sign::recover(const SignVec& signVec, const IdVec& idVec); +``` + +Collect k pair of sign `f(id) H(m)` and `id` for a message m and recover the original signature `s H(m)` for the secret key `s`. + +### PoP (Proof of Possesion) + +``` +void SecretKey::getPop(Sign& pop) const; +``` + +Sign pub and make a pop `s H(sQ)` + +``` +bool Sign::verify(const PublicKey& pub) const; +``` + +Verify a public key by pop. + +# Check the order of a point + +deserializer functions check whether a point has correct order and +the cost is heavy for especially G2. +If you do not want to check it, then call +``` +void blsSignatureVerifyOrder(false); +void blsPublicKeyVerifyOrder(false); +``` + +cf. subgroup attack + +# Go +``` +make test_go +``` + +# WASM(WebAssembly) +``` +mkdir ../bls-wasm +make bls-wasm +``` +see [BLS signature demo on browser](https://herumi.github.io/bls-wasm/bls-demo.html) + +# License + +modified new BSD License +http://opensource.org/licenses/BSD-3-Clause + +# Author + +MITSUNARI Shigeo(herumi@nifty.com) diff --git a/vendor/github.com/dexon-foundation/bls/release.props b/vendor/github.com/dexon-foundation/bls/release.props new file mode 100644 index 000000000..886ce6890 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/release.props @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup> + <ClCompile> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/vendor/github.com/dexon-foundation/bls/setvar.bat b/vendor/github.com/dexon-foundation/bls/setvar.bat new file mode 100755 index 000000000..b45af24b9 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/setvar.bat @@ -0,0 +1,6 @@ +@echo off +call ..\mcl\setvar.bat +set CFLAGS=%CFLAGS% /I ..\mcl\include /I .\ +set LDFLAGS=%LDFLAGS% /LIBPATH:..\mcl\lib +echo CFLAGS=%CFLAGS% +echo LDFLAGS=%LDFLAGS%
\ No newline at end of file diff --git a/vendor/github.com/dexon-foundation/bls/src/bls_c256.cpp b/vendor/github.com/dexon-foundation/bls/src/bls_c256.cpp new file mode 100644 index 000000000..a9f3412ea --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/src/bls_c256.cpp @@ -0,0 +1,3 @@ +#define MCLBN_FP_UNIT_SIZE 4 +#include "bls_c_impl.hpp" + diff --git a/vendor/github.com/dexon-foundation/bls/src/bls_c384.cpp b/vendor/github.com/dexon-foundation/bls/src/bls_c384.cpp new file mode 100644 index 000000000..d28f8547b --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/src/bls_c384.cpp @@ -0,0 +1,3 @@ +#define MCLBN_FP_UNIT_SIZE 6 +#include "bls_c_impl.hpp" + diff --git a/vendor/github.com/dexon-foundation/bls/src/bls_c_impl.hpp b/vendor/github.com/dexon-foundation/bls/src/bls_c_impl.hpp new file mode 100644 index 000000000..16b79f913 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/src/bls_c_impl.hpp @@ -0,0 +1,461 @@ +#define MCLBN_DONT_EXPORT +#define BLS_DLL_EXPORT + +#include <bls/bls.h> + +#include "../mcl/src/bn_c_impl.hpp" + +/* + BLS signature + e : G1 x G2 -> Fp12 + Q in G2 ; fixed global parameter + H : {str} -> G1 + s : secret key + sQ ; public key + s H(m) ; signature of m + verify ; e(sQ, H(m)) = e(Q, s H(m)) +*/ + +static G2 g_Q; +const size_t maxQcoeffN = 128; +static mcl::FixedArray<Fp6, maxQcoeffN> g_Qcoeff; // precomputed Q +inline const G2& getQ() { return g_Q; } +inline const mcl::FixedArray<Fp6, maxQcoeffN>& getQcoeff() { return g_Qcoeff; } + +int blsInitNotThreadSafe(int curve, int compiledTimeVar) +{ + int ret = mclBn_init(curve, compiledTimeVar); + if (ret < 0) return ret; + bool b; + + if (curve == MCL_BN254) { + const char *Qx_BN254 = "11ccb44e77ac2c5dc32a6009594dbe331ec85a61290d6bbac8cc7ebb2dceb128 f204a14bbdac4a05be9a25176de827f2e60085668becdd4fc5fa914c9ee0d9a"; + const char *Qy_BN254 = "7c13d8487903ee3c1c5ea327a3a52b6cc74796b1760d5ba20ed802624ed19c8 8f9642bbaacb73d8c89492528f58932f2de9ac3e80c7b0e41f1a84f1c40182"; + g_Q.x.setStr(&b, Qx_BN254, 16); + g_Q.y.setStr(&b, Qy_BN254, 16); + g_Q.z = 1; + } else { + mapToG2(&b, g_Q, 1); + } + if (!b) return -100; + if (curve == MCL_BN254) { + #include "./qcoeff-bn254.hpp" + g_Qcoeff.resize(BN::param.precomputedQcoeffSize); + assert(g_Qcoeff.size() == CYBOZU_NUM_OF_ARRAY(tbl)); + for (size_t i = 0; i < g_Qcoeff.size(); i++) { + Fp6& x6 = g_Qcoeff[i]; + for (size_t j = 0; j < 6; j++) { + Fp& x = x6.getFp0()[j]; + mcl::fp::Unit *p = const_cast<mcl::fp::Unit*>(x.getUnit()); + for (size_t k = 0; k < 4; k++) { + p[k] = QcoeffTblBN254[i][j][k]; + } + } + } + } else { + precomputeG2(&b, g_Qcoeff, getQ()); + } + if (!b) return -101; + return 0; +} + +#ifdef __EMSCRIPTEN__ +extern "C" BLS_DLL_API void *blsMalloc(size_t n) +{ + return malloc(n); +} +extern "C" BLS_DLL_API void blsFree(void *p) +{ + free(p); +} +#endif + +#if !defined(__EMSCRIPTEN__) && !defined(__wasm__) + #if defined(CYBOZU_CPP_VERSION) && CYBOZU_CPP_VERSION >= CYBOZU_CPP_VERSION_CPP11 + #include <mutex> + #define USE_STD_MUTEX + #else + #include <cybozu/mutex.hpp> + #define USE_CYBOZU_MUTEX + #endif +#endif + +int blsInit(int curve, int compiledTimeVar) +{ + int ret = 0; +#ifdef USE_STD_MUTEX + static std::mutex m; + std::lock_guard<std::mutex> lock(m); +#elif defined(USE_CYBOZU_MUTEX) + static cybozu::Mutex m; + cybozu::AutoLock lock(m); +#endif + static int g_curve = -1; + if (g_curve != curve) { + ret = blsInitNotThreadSafe(curve, compiledTimeVar); + g_curve = curve; + } + return ret; +} + +static inline const mclBnG1 *cast(const G1* x) { return (const mclBnG1*)x; } +static inline const mclBnG2 *cast(const G2* x) { return (const mclBnG2*)x; } + +void blsIdSetInt(blsId *id, int x) +{ + mclBnFr_setInt(&id->v, x); +} + +int blsSecretKeySetLittleEndian(blsSecretKey *sec, const void *buf, mclSize bufSize) +{ + return mclBnFr_setLittleEndian(&sec->v, buf, bufSize); +} + +void blsGetPublicKey(blsPublicKey *pub, const blsSecretKey *sec) +{ + mclBnG2_mul(&pub->v, cast(&getQ()), &sec->v); +} + +void blsSign(blsSignature *sig, const blsSecretKey *sec, const void *m, mclSize size) +{ + G1 Hm; + hashAndMapToG1(Hm, m, size); + mclBnG1_mulCT(&sig->v, cast(&Hm), &sec->v); +} + +/* + e(P1, Q1) == e(P2, Q2) + <=> finalExp(ML(P1, Q1)) == finalExp(ML(P2, Q2)) + <=> finalExp(ML(P1, Q1) / ML(P2, Q2)) == 1 + <=> finalExp(ML(P1, Q1) * ML(-P2, Q2)) == 1 + Q1 is precomputed +*/ +bool isEqualTwoPairings(const G1& P1, const Fp6* Q1coeff, const G1& P2, const G2& Q2) +{ + Fp12 e; + precomputedMillerLoop2mixed(e, P2, Q2, -P1, Q1coeff); + finalExp(e, e); + return e.isOne(); +} + +int blsVerify(const blsSignature *sig, const blsPublicKey *pub, const void *m, mclSize size) +{ + G1 Hm; + hashAndMapToG1(Hm, m, size); + /* + e(sHm, Q) = e(Hm, sQ) + e(sig, Q) = e(Hm, pub) + */ + return isEqualTwoPairings(*cast(&sig->v), getQcoeff().data(), Hm, *cast(&pub->v)); +} + +mclSize blsIdSerialize(void *buf, mclSize maxBufSize, const blsId *id) +{ + return mclBnFr_serialize(buf, maxBufSize, &id->v); +} + +mclSize blsSecretKeySerialize(void *buf, mclSize maxBufSize, const blsSecretKey *sec) +{ + return mclBnFr_serialize(buf, maxBufSize, &sec->v); +} + +mclSize blsPublicKeySerialize(void *buf, mclSize maxBufSize, const blsPublicKey *pub) +{ + return mclBnG2_serialize(buf, maxBufSize, &pub->v); +} + +mclSize blsSignatureSerialize(void *buf, mclSize maxBufSize, const blsSignature *sig) +{ + return mclBnG1_serialize(buf, maxBufSize, &sig->v); +} + +mclSize blsIdDeserialize(blsId *id, const void *buf, mclSize bufSize) +{ + return mclBnFr_deserialize(&id->v, buf, bufSize); +} + +mclSize blsSecretKeyDeserialize(blsSecretKey *sig, const void *buf, mclSize bufSize) +{ + return mclBnFr_deserialize(&sig->v, buf, bufSize); +} + +mclSize blsPublicKeyDeserialize(blsPublicKey *pub, const void *buf, mclSize bufSize) +{ + return mclBnG2_deserialize(&pub->v, buf, bufSize); +} + +mclSize blsSignatureDeserialize(blsSignature *sig, const void *buf, mclSize bufSize) +{ + return mclBnG1_deserialize(&sig->v, buf, bufSize); +} + +int blsIdIsEqual(const blsId *lhs, const blsId *rhs) +{ + return mclBnFr_isEqual(&lhs->v, &rhs->v); +} + +int blsSecretKeyIsEqual(const blsSecretKey *lhs, const blsSecretKey *rhs) +{ + return mclBnFr_isEqual(&lhs->v, &rhs->v); +} + +int blsPublicKeyIsEqual(const blsPublicKey *lhs, const blsPublicKey *rhs) +{ + return mclBnG2_isEqual(&lhs->v, &rhs->v); +} + +int blsSignatureIsEqual(const blsSignature *lhs, const blsSignature *rhs) +{ + return mclBnG1_isEqual(&lhs->v, &rhs->v); +} + +int blsSecretKeyShare(blsSecretKey *sec, const blsSecretKey* msk, mclSize k, const blsId *id) +{ + return mclBn_FrEvaluatePolynomial(&sec->v, &msk->v, k, &id->v); +} + +int blsPublicKeyShare(blsPublicKey *pub, const blsPublicKey *mpk, mclSize k, const blsId *id) +{ + return mclBn_G2EvaluatePolynomial(&pub->v, &mpk->v, k, &id->v); +} + +int blsSecretKeyRecover(blsSecretKey *sec, const blsSecretKey *secVec, const blsId *idVec, mclSize n) +{ + return mclBn_FrLagrangeInterpolation(&sec->v, &idVec->v, &secVec->v, n); +} + +int blsPublicKeyRecover(blsPublicKey *pub, const blsPublicKey *pubVec, const blsId *idVec, mclSize n) +{ + return mclBn_G2LagrangeInterpolation(&pub->v, &idVec->v, &pubVec->v, n); +} + +int blsSignatureRecover(blsSignature *sig, const blsSignature *sigVec, const blsId *idVec, mclSize n) +{ + return mclBn_G1LagrangeInterpolation(&sig->v, &idVec->v, &sigVec->v, n); +} + +void blsSecretKeyAdd(blsSecretKey *sec, const blsSecretKey *rhs) +{ + mclBnFr_add(&sec->v, &sec->v, &rhs->v); +} + +void blsPublicKeyAdd(blsPublicKey *pub, const blsPublicKey *rhs) +{ + mclBnG2_add(&pub->v, &pub->v, &rhs->v); +} + +void blsSignatureAdd(blsSignature *sig, const blsSignature *rhs) +{ + mclBnG1_add(&sig->v, &sig->v, &rhs->v); +} + +void blsSignatureVerifyOrder(int doVerify) +{ + mclBn_verifyOrderG1(doVerify); +} +void blsPublicKeyVerifyOrder(int doVerify) +{ + mclBn_verifyOrderG2(doVerify); +} +int blsSignatureIsValidOrder(const blsSignature *sig) +{ + return mclBnG1_isValidOrder(&sig->v); +} +int blsPublicKeyIsValidOrder(const blsPublicKey *pub) +{ + return mclBnG2_isValidOrder(&pub->v); +} + +#ifndef BLS_MINIMUM_API +inline bool toG1(G1& Hm, const void *h, mclSize size) +{ + Fp t; + t.setArrayMask((const char *)h, size); + bool b; + BN::mapToG1(&b, Hm, t); + return b; +} + +int blsVerifyAggregatedHashes(const blsSignature *aggSig, const blsPublicKey *pubVec, const void *hVec, size_t sizeofHash, mclSize n) +{ + if (n == 0) return 0; + /* + e(aggSig, Q) = prod_i e(hVec[i], pubVec[i]) + <=> finalExp(ML(-aggSig, Q) * prod_i ML(hVec[i], pubVec[i])) == 1 + */ + GT e1, e2; + BN::precomputedMillerLoop(e1, -*cast(&aggSig->v), g_Qcoeff.data()); + const char *ph = (const char*)hVec; + G1 h; + if (!toG1(h, &ph[0], sizeofHash)) return 0; + BN::millerLoop(e2, h, *cast(&pubVec[0].v)); + e1 *= e2; + for (size_t i = 1; i < n; i++) { + if (!toG1(h, &ph[i * sizeofHash], sizeofHash)) return 0; + BN::millerLoop(e2, h, *cast(&pubVec[i].v)); + e1 *= e2; + } + BN::finalExp(e1, e1); + return e1.isOne(); +} + +int blsSignHash(blsSignature *sig, const blsSecretKey *sec, const void *h, mclSize size) +{ + G1 Hm; + if (!toG1(Hm, h, size)) return -1; + mclBnG1_mulCT(&sig->v, cast(&Hm), &sec->v); + return 0; +} + +int blsVerifyHash(const blsSignature *sig, const blsPublicKey *pub, const void *h, mclSize size) +{ + G1 Hm; + if (!toG1(Hm, h, size)) return 0; + return isEqualTwoPairings(*cast(&sig->v), getQcoeff().data(), Hm, *cast(&pub->v)); +} + +void blsSecretKeySub(blsSecretKey *sec, const blsSecretKey *rhs) +{ + mclBnFr_sub(&sec->v, &sec->v, &rhs->v); +} + +void blsPublicKeySub(blsPublicKey *pub, const blsPublicKey *rhs) +{ + mclBnG2_sub(&pub->v, &pub->v, &rhs->v); +} + +void blsSignatureSub(blsSignature *sig, const blsSignature *rhs) +{ + mclBnG1_sub(&sig->v, &sig->v, &rhs->v); +} +mclSize blsGetOpUnitSize() // FpUint64Size +{ + return Fp::getUnitSize() * sizeof(mcl::fp::Unit) / sizeof(uint64_t); +} + +int blsGetCurveOrder(char *buf, mclSize maxBufSize) +{ + return (int)Fr::getModulo(buf, maxBufSize); +} + +int blsGetFieldOrder(char *buf, mclSize maxBufSize) +{ + return (int)Fp::getModulo(buf, maxBufSize); +} + +int blsGetG1ByteSize() +{ + return mclBn_getG1ByteSize(); +} + +int blsGetFrByteSize() +{ + return mclBn_getFrByteSize(); +} + +void blsGetGeneratorOfG2(blsPublicKey *pub) +{ + *(G2*)pub = getQ(); +} + +int blsIdSetDecStr(blsId *id, const char *buf, mclSize bufSize) +{ + return mclBnFr_setStr(&id->v, buf, bufSize, 10); +} +int blsIdSetHexStr(blsId *id, const char *buf, mclSize bufSize) +{ + return mclBnFr_setStr(&id->v, buf, bufSize, 16); +} + +int blsIdSetLittleEndian(blsId *id, const void *buf, mclSize bufSize) +{ + return mclBnFr_setLittleEndian(&id->v, buf, bufSize); +} + +mclSize blsIdGetDecStr(char *buf, mclSize maxBufSize, const blsId *id) +{ + return mclBnFr_getStr(buf, maxBufSize, &id->v, 10); +} + +mclSize blsIdGetHexStr(char *buf, mclSize maxBufSize, const blsId *id) +{ + return mclBnFr_getStr(buf, maxBufSize, &id->v, 16); +} + +int blsHashToSecretKey(blsSecretKey *sec, const void *buf, mclSize bufSize) +{ + return mclBnFr_setHashOf(&sec->v, buf, bufSize); +} + +#ifndef MCL_DONT_USE_CSPRNG +int blsSecretKeySetByCSPRNG(blsSecretKey *sec) +{ + return mclBnFr_setByCSPRNG(&sec->v); +} +#endif + +void blsGetPop(blsSignature *sig, const blsSecretKey *sec) +{ + blsPublicKey pub; + blsGetPublicKey(&pub, sec); + char buf[1024]; + mclSize n = mclBnG2_serialize(buf, sizeof(buf), &pub.v); + assert(n); + blsSign(sig, sec, buf, n); +} + +int blsVerifyPop(const blsSignature *sig, const blsPublicKey *pub) +{ + char buf[1024]; + mclSize n = mclBnG2_serialize(buf, sizeof(buf), &pub->v); + if (n == 0) return 0; + return blsVerify(sig, pub, buf, n); +} + +mclSize blsIdGetLittleEndian(void *buf, mclSize maxBufSize, const blsId *id) +{ + return mclBnFr_serialize(buf, maxBufSize, &id->v); +} +int blsSecretKeySetDecStr(blsSecretKey *sec, const char *buf, mclSize bufSize) +{ + return mclBnFr_setStr(&sec->v, buf, bufSize, 10); +} +int blsSecretKeySetHexStr(blsSecretKey *sec, const char *buf, mclSize bufSize) +{ + return mclBnFr_setStr(&sec->v, buf, bufSize, 16); +} +mclSize blsSecretKeyGetLittleEndian(void *buf, mclSize maxBufSize, const blsSecretKey *sec) +{ + return mclBnFr_serialize(buf, maxBufSize, &sec->v); +} +mclSize blsSecretKeyGetDecStr(char *buf, mclSize maxBufSize, const blsSecretKey *sec) +{ + return mclBnFr_getStr(buf, maxBufSize, &sec->v, 10); +} +mclSize blsSecretKeyGetHexStr(char *buf, mclSize maxBufSize, const blsSecretKey *sec) +{ + return mclBnFr_getStr(buf, maxBufSize, &sec->v, 16); +} +int blsPublicKeySetHexStr(blsPublicKey *pub, const char *buf, mclSize bufSize) +{ + return mclBnG2_setStr(&pub->v, buf, bufSize, 16); +} +mclSize blsPublicKeyGetHexStr(char *buf, mclSize maxBufSize, const blsPublicKey *pub) +{ + return mclBnG2_getStr(buf, maxBufSize, &pub->v, 16); +} +int blsSignatureSetHexStr(blsSignature *sig, const char *buf, mclSize bufSize) +{ + return mclBnG1_setStr(&sig->v, buf, bufSize, 16); +} +mclSize blsSignatureGetHexStr(char *buf, mclSize maxBufSize, const blsSignature *sig) +{ + return mclBnG1_getStr(buf, maxBufSize, &sig->v, 16); +} +void blsDHKeyExchange(blsPublicKey *out, const blsSecretKey *sec, const blsPublicKey *pub) +{ + mclBnG2_mulCT(&out->v, &pub->v, &sec->v); +} + +#endif + diff --git a/vendor/github.com/dexon-foundation/bls/src/proj/bls.vcxproj b/vendor/github.com/dexon-foundation/bls/src/proj/bls.vcxproj new file mode 100644 index 000000000..b78c97919 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/src/proj/bls.vcxproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1DBB979A-C212-45CD-9563-446A96F87F71}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>ec_test</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(SolutionDir)common.props" /> + <Import Project="$(SolutionDir)debug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(SolutionDir)common.props" /> + <Import Project="$(SolutionDir)release.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + <TargetExt>.lib</TargetExt> + <OutDir>$(SolutionDir)lib\</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + <TargetExt>.lib</TargetExt> + <OutDir>$(SolutionDir)lib\</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="$(SolutionDir)src\bls.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/vendor/github.com/dexon-foundation/bls/src/qcoeff-bn254.hpp b/vendor/github.com/dexon-foundation/bls/src/qcoeff-bn254.hpp new file mode 100644 index 000000000..18d169568 --- /dev/null +++ b/vendor/github.com/dexon-foundation/bls/src/qcoeff-bn254.hpp @@ -0,0 +1,564 @@ +#if MCL_SIZEOF_UNIT == 8 +static const uint64_t QcoeffTblBN254[][6][4] = { + { + {0x8c5c1b842e501310ull,0x6a418cdaced77710ull,0xf5ad725dd0d9a5ffull,0x012d501f32362f48ull,}, + {0xb8a8a8c11e51dc62ull,0xeaeb87e0f25a8611ull,0x9ba8738e4483d511ull,0x0664a4e36d64379eull,}, + {0x4a5af38c0aa5930aull,0x189fef61a74c388dull,0x83cc3225c7748527ull,0x2107491582310dc6ull,}, + {0x43aef621120a524aull,0x359d06a56e339486ull,0xdf5ab35e2222d9b1ull,0x20968bac939743acull,}, + {0xe8e4c0bb65cd67b8ull,0x255a0859bc55ff2cull,0xf1c57d1da3c060c6ull,0x138d83468f42cc0eull,}, + {0xdf985e5f768c149cull,0xa059c65c4b5da3ffull,0xed3d38d9f77bb968ull,0x02281f01255a850cull,}, + }, + { + {0xe3f53d8cfb4866a0ull,0xa0f9a16a21c159aaull,0x647fc210c7edf3a9ull,0x0db92f588c73caf9ull,}, + {0x6e9349b777bc2cf1ull,0x4fd987eb22e2469cull,0x666644a8e61b0a0eull,0x02f5bf9aae96c0deull,}, + {0xd5fd6288342479ebull,0x74022b671c6c8d8eull,0xda32d1b497cac7b2ull,0x0abecf35a19b5c7eull,}, + {0x1500891565b5f9aaull,0x4b7ce141cd7f4361ull,0xadf3447c534846c1ull,0x078b36a30d45de5full,}, + {0x37f172cff76e4b77ull,0x696d093b3ee37e4aull,0x2193797b7da56c6eull,0x1f5fc9efcbbb93e7ull,}, + {0x4c7d799b765b8f44ull,0x7adfd285e906edd8ull,0x79d68eaaf88a0885ull,0x20707d672be892cbull,}, + }, + { + {0x84bbf3849c691e74ull,0xeeb90e1efc3e3436ull,0xd9d9bb6257bf19e4ull,0x1b37ef04ea7d6f85ull,}, + {0xa6bdbbe0895ba12aull,0x58cade2ad0f1aa84ull,0xe0bb325678a2c748ull,0x23d1992e977c788cull,}, + {0x44559f0b0f4bb2ccull,0xe61b479bc88980eeull,0x2a70aa9df3e28c92ull,0x18039bee97722b74ull,}, + {0x9e5667da3db8e9e6ull,0x826ba07eb28c31f8ull,0x3f8b4eeb463d6923ull,0x1af85c2b10d3a2f0ull,}, + {0x8783f372684ea930ull,0x1aa0d9e436f41ea7ull,0xc84a3fc56af9f624ull,0x0d02698756cd5a2cull,}, + {0xe47407ede7b7c2afull,0x7d665c59e37ee7a7ull,0x542b91f12e0fa2a7ull,0x2084e73dc21f415eull,}, + }, + { + {0x2aebe318f3d167c6ull,0x5a2b2364b3abc614ull,0x31b2cdfd847e0053ull,0x04f0f63eed2a2f8cull,}, + {0x0573d320ee14ecf4ull,0x4e0dc9d92e543ddeull,0x58a280570cac8d36ull,0x16226935e8e9f9bdull,}, + {0x2d51a89174717a26ull,0x7341be7f883d0806ull,0xc9b4ee66364066ceull,0x018c79b95f127b49ull,}, + {0xe5420d2f4210dbd7ull,0x179c22d607a5c801ull,0xe3aae016e739bcc8ull,0x20c554233ddd50caull,}, + {0x6c5c4b29c77bb152ull,0xc30df398c85f0f2cull,0x5d5096a07ed6a257ull,0x0790d485c22a3639ull,}, + {0x8aadc7bbf2cb348eull,0xc339d87c2118c2cfull,0x8f49e0eb46961ca9ull,0x24740f0ee2134c2cull,}, + }, + { + {0x3b80354a061dbf06ull,0x961e0dfd74b84147ull,0xeb4b27dbde455fc1ull,0x100da22e6baf58b5ull,}, + {0xb156ffc78a60a8acull,0xc873bf776b8daaeeull,0x5a702f5446bf83fdull,0x1fce59e50222949bull,}, + {0x32d7640c0f717812ull,0xc58d05abdc19ceedull,0x1e63c2a492849373ull,0x23443ce8fb2d6feaull,}, + {0x870f2d1a2e39f52eull,0x7aa53cb06541429aull,0xee7b80b7031f23beull,0x0a8a095b3fdf2cf6ull,}, + {0x4e489bd278487a58ull,0xa914d93e5ed31065ull,0x6720c32ae140db7aull,0x0c22020e6a97031full,}, + {0x7535115a15420cceull,0x2cd019bac6256080ull,0x8234c3b61757e461ull,0x24d65e78c88298b2ull,}, + }, + { + {0x1f0bdc2cae53aa21ull,0x263506a6526641afull,0xacd41097fab7f62full,0x0b2c92453d474a86ull,}, + {0x2d23a58a46d63e3aull,0xa65ff6f1f716fe37ull,0xb86dc831f970fb2dull,0x0bc3cf38a191e63aull,}, + {0xeb0ca4fdeba41bbaull,0x969cf610e1a3a009ull,0x93c5d1bad6c7240bull,0x20ad29c9a9f1d6d6ull,}, + {0x006a12a187464b7aull,0xe354d9be0ec65202ull,0x9dff5c227947f5b7ull,0x24e3dc2833ba4d2full,}, + {0x9350693ebfdfb4c6ull,0x07d8abf27abb8fc3ull,0x58f5ab0b518e5113ull,0x125f2d7d40ed8650ull,}, + {0xc9fd435af6e86f34ull,0x04dc07374f373455ull,0xd040d286d71db00dull,0x141a1253f3bc2a50ull,}, + }, + { + {0xbcfee5dad6ad33b7ull,0x8cd72df36c5b56daull,0xc2949399ad52da69ull,0x0f6ffe6d68a398d6ull,}, + {0x777dc689b038aaf4ull,0xf7a8f41c7c04e9f1ull,0xcdab24ebcea39892ull,0x0178d69b1b935d81ull,}, + {0x65a001a22be563c6ull,0xfc1b2634dc76eafeull,0xed4f6ea19949392full,0x0e4e9127957d60e7ull,}, + {0x919a1c91a123e003ull,0x23f8ec239ef8a15dull,0x0470cb40e520d6f5ull,0x0be9b58098cd0f01ull,}, + {0x735e236220cf1152ull,0x82e68710903f65b1ull,0x6c932338d29169ccull,0x0e204d6a8c7d5034ull,}, + {0xac47692ec8245f1full,0x125db7c68d7e7a9bull,0x6ead9899d3150beaull,0x1957068d4a3da4b8ull,}, + }, + { + {0x45c168b2bce7b4daull,0x63afa3b276f9f910ull,0x60af02b6be9889a6ull,0x1adad7fa35385ae7ull,}, + {0x8d35cd7e7df59aa6ull,0x13cf29589f4b84b1ull,0xec6ecff2e1540013ull,0x0ecbf75abda6eb1dull,}, + {0xf6ce05fc3becfc23ull,0xe4ac8d257a7bf44eull,0x4c12510765eeaa43ull,0x06c870a377df50e4ull,}, + {0x2f6871bdc1d62dd7ull,0x80591505c1279cb7ull,0x1322088b2719ecd2ull,0x222e71f8f5995a2bull,}, + {0x2d1a1ab198363dfbull,0x35635c96cfa670ceull,0x7d5034dd7a26c656ull,0x003bf0608625abedull,}, + {0x98ca35cf5ed8716cull,0x2265e1237bc6df23ull,0x403b67933e14f23bull,0x17bd2dadc39729fdull,}, + }, + { + {0x73eaf26576b3ee71ull,0x1e385de29d896044ull,0x25a0f40f08a59317ull,0x19849935bfbebeeaull,}, + {0xc124cb642102cadcull,0x15bc408ad6ca7826ull,0x2d7fb7c9392b5314ull,0x191fe8471669f053ull,}, + {0x4519ddbccb6a7c26ull,0xf93bd195baec8228ull,0xacd754a721948defull,0x12f17b60c7e426bdull,}, + {0xcf447b92b04c15dbull,0xfcb7da793167f250ull,0xcbabb4ee570c4306ull,0x190ab94c6e5c81ceull,}, + {0x66edbe6740930cfcull,0x00c8c644983a181full,0xfe9e80b984c44209ull,0x1dd6f530584a7ffaull,}, + {0x14c61214aa1a9038ull,0xc34e5e23426cf8b6ull,0x89fca910ec46ae5full,0x04f1b9161a0f7c1dull,}, + }, + { + {0x60c3a79ac91ab4deull,0x541e051ca71a1a2bull,0x490abafd41a5d25cull,0x126275c8a46cf343ull,}, + {0xe5da0fcfffccd2b6ull,0xe3820301b166bb43ull,0xc6599e01bed6085dull,0x226548dff57c5cfbull,}, + {0x36428b1296882728ull,0xe08312e604299b9aull,0x5a15c889ce55478dull,0x172710198cd7c270ull,}, + {0x2450f291477cc1ddull,0xcb0f85c9d92d1bc3ull,0x86325c11cfe0e296ull,0x13ff03a4bd5be082ull,}, + {0x74298091e426bf55ull,0xbed700b48330ccdfull,0xb1ec45894f74fb11ull,0x1716d956bea958b0ull,}, + {0x91b29e513e9a4114ull,0xcdb3b373910c02fdull,0x268e148f9431fa75ull,0x1288ec8fde3009bdull,}, + }, + { + {0x02ae4c95e0afb8caull,0x8e7aec631cf8f5dfull,0xdfd9373259eca3c3ull,0x1fed34fb88af7224ull,}, + {0xc47e420205b5c88full,0x7207ef7451d1c567ull,0x53262358433f5294ull,0x193248ecf07ad085ull,}, + {0x49de15f9bb694200ull,0xc35f531086b5c242ull,0x95a1903858cd5140ull,0x032a4992511b1f97ull,}, + {0x42ee2c4def1faaa7ull,0xf6ca28bc9d99cd60ull,0x83c60d620a1e004cull,0x024ccf0ba1568759ull,}, + {0x6122291bf42e7d82ull,0x0866090d368a8205ull,0x11f04812ad6ec708ull,0x14cdebecb4ec13edull,}, + {0x535e8fd1ac15390dull,0xb37b579abb1773daull,0xbace0a295cd4b579ull,0x215e20d42270bcb0ull,}, + }, + { + {0x400bdbc644ac1d92ull,0x6d856667d971f595ull,0x03343816a1bd40f7ull,0x0361ad7534821a43ull,}, + {0x824222acf8437091ull,0x79141c3205b1032full,0x6b4d331fc9974530ull,0x1bf965a7ba2bade5ull,}, + {0x0bf66d1afdad6063ull,0xfe6571464fe71527ull,0x3ec25815cc90ab9bull,0x132ca2d9d51c3b56ull,}, + {0x37e3ae17fb5ac815ull,0x2dfedb4efe3f37c0ull,0x4b086ea5032745a4ull,0x0f966cabdd479e9full,}, + {0xb5266c229b7ebe0dull,0xc6717a5442929826ull,0xad22a19d8892adf1ull,0x172da87fcc14d4f9ull,}, + {0xae0d9866d891bb59ull,0xc500c36e3fe7d354ull,0xc2b582f2929b23abull,0x11428eb730dd4e8full,}, + }, + { + {0x81538fef8e07dae0ull,0x3c05274665489b39ull,0x36e4401350ceb55bull,0x23822f2029f31339ull,}, + {0x9a946e7c30090ad9ull,0x5bbc4c8c656ea3fdull,0x3cc2cecb7ec7227full,0x075a6fe87014899full,}, + {0x504b2ff7fbb0366bull,0xdbf315791bc3d5e8ull,0x34b16de185c8c4faull,0x0c722a3dffe0761cull,}, + {0xe1b2c1fc3b33c383ull,0xce84d3e5182665f5ull,0xbcedf2f72de4d795ull,0x1a84c62c0c4a6f6full,}, + {0x85ebabd309ae9553ull,0x1330ec03b0ac91f7ull,0x8f42ba9c8c1ae123ull,0x24c230fae89db4b9ull,}, + {0x63ba534e151566b6ull,0x7e44c5bd39e6334full,0x06921595325d11dfull,0x217f3a4e9d6413deull,}, + }, + { + {0x25ac71f16a82e592ull,0x47846dfdcc378ef2ull,0x75c53c75b38260a2ull,0x039b9da33bf9b997ull,}, + {0x53d30cb619b09dfeull,0x566d6a55a184cd91ull,0xa589c53ae28a8e0full,0x13c05b500d5f285eull,}, + {0xd22faf3af0a087b6ull,0xd5e538653ca52380ull,0x42c893b42092e080ull,0x18f7a1bdd3badfbbull,}, + {0xdba4e6c94bb0a0b2ull,0x323d4769578ee4deull,0xbaedb0f8e01fdb15ull,0x21ca037715dcfe00ull,}, + {0xe6ccc0bc06afac14ull,0xfb943c10916b581cull,0x2d5694a4c968aff2ull,0x054a1b209a812e31ull,}, + {0x1983e59a45dcb02cull,0x71dcb184a30af740ull,0xb75b69bd5ae155acull,0x13c7fc9ace199224ull,}, + }, + { + {0xddbd6b95067516b5ull,0x29ca0360372d54e8ull,0x3e2955c1d6748678ull,0x1f8b276aafcd2c7dull,}, + {0x893187796c272ab6ull,0xc843325fc53fa37eull,0xbe658fac833007a3ull,0x04bdf08356fbd83full,}, + {0xa0863d3fd012aa1cull,0xb1b2c2c3c2fa879eull,0x4cd718b80433407dull,0x1e1ff82d0a23f609ull,}, + {0x0c72fdbda5da70b5ull,0xfa2ad5a7dafb202bull,0xa63ce1e889feffefull,0x030b328f5fa93e0full,}, + {0xc4a01585dc609f7eull,0xade61ef3353eda34ull,0xfa884e9a73d65e8eull,0x24750424a4543a02ull,}, + {0x54f07e883bbe27b6ull,0xfb41ed1660623383ull,0xe112647feeae3cabull,0x055cf71a930304b0ull,}, + }, + { + {0xcc5f813b041ba372ull,0x1b892909c069bfd9ull,0xdfac1a47d46ba3dcull,0x1bc553fdedaa97e3ull,}, + {0x623da812c8d71640ull,0x59b3b84486ab96c5ull,0xd77a7d970676d563ull,0x09473f20b0087846ull,}, + {0x9214acc8a6ad6f76ull,0x53e9b1713dffaa0aull,0xe66631ab33f6477cull,0x16792dc3fd2138d9ull,}, + {0x612c9ffc45facb86ull,0xd43cb433555b3da3ull,0xb0ca697731e8202dull,0x141ac2b6bfa546e5ull,}, + {0x51b480946640c6a2ull,0xc71f677b6d96bb2bull,0x7e0377527663c0beull,0x036b2f551e8c7db8ull,}, + {0x09610b7524482b53ull,0x65196312af7438ccull,0x7050f94a8a70305eull,0x06fde0d46e6c059eull,}, + }, + { + {0x707927b8fc061859ull,0xd9e38cc9ebbd94ddull,0x96eba99c855f975full,0x0c12d088d263d28aull,}, + {0xfa236e22ee58216aull,0x470b1efa73ec6699ull,0x4c5457a04dbf7553ull,0x1a1dc4cbd3ccec1aull,}, + {0x9a327665f6db6d31ull,0x6443a4f683536914ull,0x58eff845741ae1d6ull,0x0b784f2a8c259646ull,}, + {0x08cfd913a263ce94ull,0xe58aab8c6b488744ull,0x335fa717116557daull,0x137bf0016a4e4c17ull,}, + {0x0c14566b7ca1106full,0xb5fac75743cf44ddull,0xe87d1d95b95cba63ull,0x1d2823802dac3d01ull,}, + {0x445099d6807bd76cull,0x41b66837529eb51bull,0x84267670e2264913ull,0x0ed84664bb37032eull,}, + }, + { + {0x938964e622d307e8ull,0x2edeb24656039ea6ull,0x642dd6f7e2144be3ull,0x1d31590cb07cb098ull,}, + {0xe57bf1b8729263c1ull,0x48f9b371fd250d79ull,0x670ce0ee36513b90ull,0x1b908986cbfec7f1ull,}, + {0x9fc8ffb876636effull,0xd57385d67c117698ull,0x4813753691eeba7full,0x0e36785e030209eaull,}, + {0xeef1935cb4c5e8f1ull,0x1b8726a75ab06681ull,0xee973c5cd718bf31ull,0x026910b1fafe0208ull,}, + {0x8c1826b08792fd9bull,0x00325e83cb419665ull,0x9cf44c5b81265badull,0x2462a8c0fc4f85f9ull,}, + {0xa4068de0bcf85b4cull,0x5292433f89646bedull,0x05b4bdd364d3bc53ull,0x1e25be7fab47bf9aull,}, + }, + { + {0x51c27ca3424bdf72ull,0x167926750fe4d445ull,0x41985a737513c6e8ull,0x070056ab60d56287ull,}, + {0x0a23d1344dfd91a0ull,0x6c518fef27a24e64ull,0x059a8c49360f8730ull,0x0f1d38b2c12772f2ull,}, + {0xaa2a1e60b126566eull,0x1ed2add1bb218007ull,0x71385f0a8fabe78eull,0x024c0880d7c0fd5aull,}, + {0xeef5704923a38ff1ull,0x34506a9872581fa9ull,0x78152bc691cbac5dull,0x0c41086d97a7fccaull,}, + {0xb0c0d854ad72b6b6ull,0xb38455c3e3e5f457ull,0xfe665f1f4ddafb6dull,0x10373cbf9ca2add9ull,}, + {0x8a306e7799aa2605ull,0x5dbca515ad2f9733ull,0x9b8b80da928edeb0ull,0x0052a2d2f8f7b1e2ull,}, + }, + { + {0x13e3e3df198f8864ull,0xc80f05cd02b931f3ull,0x8826debe7162b2f6ull,0x1d319ece62ae45e7ull,}, + {0x313e17d4fa80fd67ull,0x82c5f606bfe97eabull,0x66f092bfa6b46100ull,0x16fde5bd28d86353ull,}, + {0xcd4e7dfcd19cfb45ull,0x026d1e42ed44630bull,0x8d6b54119bc07918ull,0x1eff361145a4818bull,}, + {0xc80d511a9a448566ull,0x9df3e33a28a32065ull,0x5a5860db779cc4aaull,0x1c226a0a4bf8c193ull,}, + {0xfe0fa440138c1ebcull,0xc32c16bd93c71daaull,0x5e053ef1a9d73a8eull,0x2105d2d85afe7c65ull,}, + {0x553c6840e4d14fdfull,0x600506d781612ff5ull,0x3ab288079ba2da8full,0x19b8f14b3e9cefeaull,}, + }, + { + {0x101f9567b577f4ccull,0x9d7dfbbb95010b1eull,0x1801c3f5ef323a26ull,0x08066f8c302be6e0ull,}, + {0x301f867187aa8cc4ull,0xdcb504ccd5deb64bull,0x7a19b8838cf066e1ull,0x1ce06a9c35aa0809ull,}, + {0x010a732bda3f076eull,0xf36ad54eeb0df727ull,0xe7e3ba3699eb12eeull,0x1d65654037809723ull,}, + {0xb8ff82aa0c8f9e89ull,0x39fd76e872772dd1ull,0xd0a9a0cf7b300237ull,0x21cdd8098a877d70ull,}, + {0xfff1cbe2921532d7ull,0xe919f4cbb2b62082ull,0x43858e6488e4d9f3ull,0x227d32cd853e2a11ull,}, + {0xdd7807401672de18ull,0x7e3167a195002069ull,0xef20051461812a1full,0x1ee6ee09899caca3ull,}, + }, + { + {0x18dcb2c8d68bcf3dull,0x55c30335c441d056ull,0xddcda87759df1c4cull,0x0bd72b9d00117407ull,}, + {0x53759bf204dc6ee2ull,0x5a491198ccc07fb6ull,0x21023e765d4b082bull,0x052467582f570a64ull,}, + {0xc71f8479e69bc9efull,0x1a8b07f3a7f9f4e4ull,0x4898f9336938503bull,0x210b416bb55f686dull,}, + {0x2ea76a804a514216ull,0xaed1c043402cba72ull,0x8e96b191c8508968ull,0x0a6845487a544d0cull,}, + {0x20f8a88abe36a0fbull,0xf7be80390c4df565ull,0xb4d6ae73ab0ac7b4ull,0x03dee2bd150d75caull,}, + {0x31f41f54a9d5ba23ull,0x32d8a838645e8303ull,0x1ce68866725d4d63ull,0x16eff9d7d55f24a6ull,}, + }, + { + {0xc9ef98de3048fe85ull,0x91d247303ba2cc5dull,0xfeebf32febfe0c50ull,0x12193bd2dfc7cbaaull,}, + {0x05545cc46d6e2f10ull,0x0c1885bd6a173fe0ull,0x19192206ce77ae4dull,0x21bc567dedda3bcaull,}, + {0x0289985f4f8a3e0eull,0x46a6f360ff57d0beull,0x8ecf6d8914a57a28ull,0x16fad252e99a0f5dull,}, + {0xa1ce7650862f87aaull,0x624601ad20a0a754ull,0x181fa95e1dceca7aull,0x04c7063bf6031512ull,}, + {0x47221f77cb9dead6ull,0x0b0a1f41bf04b7daull,0x1285ec2ea904f669ull,0x05d815fd67d084b4ull,}, + {0x2f4621c7c48ac6bfull,0x6c94a7fc7433ddc8ull,0xbfbc34ad00dc77bdull,0x0d420c22daa0e425ull,}, + }, + { + {0xa125bb06b8f5ae5cull,0xf130e54b42e247baull,0xa7d5d0e59b914ac6ull,0x071f28cba94510baull,}, + {0x23781cfd40419519ull,0x2ea1f31e32e9865dull,0xb81d3422cdc1a049ull,0x09b4ecf31bed5dadull,}, + {0x7cad0528d1f2ffbdull,0x4aac3a0629f7f4f7ull,0xffa90428bf6d62ffull,0x1e313094fa295c2eull,}, + {0xac9d8af47d98869cull,0x8ecebc8bdf6c41e8ull,0x859d29cb97f9f264ull,0x0c9223c674634d76ull,}, + {0x5adcabb24bf08460ull,0xbc91aaa43338b671ull,0x7abcd2f2031ec66dull,0x19b3dbaaf6fb5a1bull,}, + {0x00b0c3d6c69380bbull,0x044a0a413e3aaea9ull,0x48d820b0f17d1ac2ull,0x1745bb82ed277652ull,}, + }, + { + {0xd921b459e78504aeull,0x79ef5733fecdb405ull,0x04020f6200148defull,0x1163b626e015e688ull,}, + {0x0781fcc9b627e44bull,0x5d8c6c8944d557a6ull,0x5493d9920c1d32fcull,0x0ecdc7510a2f454aull,}, + {0x7086854c556b47fdull,0x4ec3f6dd8ad274dbull,0x274e92925edf85deull,0x09e6aa987250022full,}, + {0xa63453a7eb3a8fb5ull,0xbd83f1e026f71f82ull,0x1386ec55e6450e3full,0x00873f000047164eull,}, + {0x179dbc93073fcb3aull,0x592c5c9b8baf6411ull,0x4b81a7b27b4d9070ull,0x1d26ead51df9a20eull,}, + {0x6a244f14dc36671cull,0xd1e9d82e3c5bea31ull,0xbd883c1283d17771ull,0x1e09e59618c6163full,}, + }, + { + {0xc1b0578027cdeed9ull,0x7ad19ad5cb04d6e5ull,0xee6f7f36d5ed1465ull,0x01d616ac45e80f5full,}, + {0x2c0c7df57e945feeull,0x9709cf12715b87afull,0xa6e99327a9e2f868ull,0x1dc75e316e45b2aeull,}, + {0xa7bc3e0832276f4bull,0x36ed99677fa22ffaull,0x89da95557e5dd91eull,0x0c1f4bf5d672d3b9ull,}, + {0x25624941c1047a5full,0x463ccb3bd3fce3b1ull,0xd115fc8570096682ull,0x17145e34ff1d0e9aull,}, + {0x4a3a34676a6a378full,0xac89a12198b0ca1cull,0xb97a2d982319e20eull,0x0caf54593dcf42e9ull,}, + {0x7a07a3d321faf4daull,0x6a062e2ec939fd56ull,0xfd7ac47f692009a9ull,0x1121561f1c332cd7ull,}, + }, + { + {0xcfb495c8f564f52cull,0x39665331e96c838bull,0x42c49998a1446b14ull,0x03cc4e294cff3ff7ull,}, + {0xd41d69b42b557d10ull,0x98dab8bd722a39a0ull,0xd4e24c4add54c81aull,0x1344527908d19fa6ull,}, + {0xe9648caa7c8da128ull,0x8497aa165fdee967ull,0xf437d75fab691b76ull,0x052cbd6eb6436a4bull,}, + {0x389f7092e280920bull,0x9b8625c09555310bull,0xe91f49f9d9031898ull,0x1c95a9d881b18be8ull,}, + {0xe8605b4d2212b1fbull,0xb1c4f57736dbf0c3ull,0x8a90c4bcc09cad9eull,0x12f03ba47d2620d4ull,}, + {0xcbd4494a5830ba3cull,0xb5a5d7b6b635fb6dull,0x154076781060c57aull,0x14e27241d5bdbe5dull,}, + }, + { + {0x5545df3af64ec9c4ull,0xff2adbc37d224acdull,0xcf02fc8672ce69ffull,0x0a7fcfe0b85478f0ull,}, + {0x402246e5d134054cull,0x0bd5980440304ad7ull,0x3df09979193914b6ull,0x22610927d3977e51ull,}, + {0x08235659dbd58c8full,0xd159c4e705d2f6d9ull,0x3c5ae22b53836251ull,0x137039c4b43f1c9dull,}, + {0x4ee6c2b196d188bbull,0x54ecda987459243eull,0xb3a9cfbf1aea2748ull,0x234243a4a87cf61eull,}, + {0x248eec552d9a5ef7ull,0xc8a98bee264e9e26ull,0xf3bcd8c268d0c073ull,0x16e365499a23e913ull,}, + {0xbb406c86a8f7f2d7ull,0x03426cc36d053972ull,0x047915ec9f472c4dull,0x2318c0030bfcee73ull,}, + }, + { + {0x3c783caa5308c82dull,0x81bcacdec8f45662ull,0xe169822ce2c0837cull,0x09c179836e05b980ull,}, + {0xf5d882cd842d337full,0x861761db32052e52ull,0xd6721854e7e686f2ull,0x0d22ec35de13a291ull,}, + {0xd9dd477876f2c6d0ull,0x5ef6dd9d6e4eb6b3ull,0xa22e8bf49d19a102ull,0x1fb12cb296762e6aull,}, + {0x8372df5211227b55ull,0xc3994286779c5c02ull,0xa302f7b3be87ac5bull,0x22b842b9b918d821ull,}, + {0x2cb75b8cb17911a1ull,0x5cd8f56c7f4dacf8ull,0x09874f95dd87d8d6ull,0x15b92554f1bdb068ull,}, + {0x4786ec1f88a80264ull,0x91dc53364f6aec54ull,0xbd9bd414e46eb290ull,0x1b27b7fd99d5e212ull,}, + }, + { + {0xbb40271789b4bb9cull,0xddf3b8f645386314ull,0xce090cc4ffeabe23ull,0x0c3920ea76b361f4ull,}, + {0x14c64e1eed2b5edeull,0x99c5289af2511b43ull,0x5de1d7b1dccb2575ull,0x0b5e4419ad2e1c52ull,}, + {0x0c04995f7bb764c0ull,0xbd9eb56e1c742072ull,0x9009271bd281dfd1ull,0x2464821365b75205ull,}, + {0x49724e13fe376d0cull,0x189fb55cbe1abfc2ull,0x80162bfa5b8980d5ull,0x1a96550a3916c5caull,}, + {0xcd79e4d9633065d2ull,0x2b51887668a49a0aull,0x8785b375ac581035ull,0x10a5547822c082bfull,}, + {0xb98da2585b65ccd3ull,0xa8015a03bee86a26ull,0x2eb6a1e1bd1cdf1bull,0x07bf364897d1c8b8ull,}, + }, + { + {0xb791c26545931abcull,0x9a1ad86e4fda79aeull,0x06855828328d0314ull,0x116650fafca899dcull,}, + {0x28a52543d8cb599cull,0xbdd390c86fa4fb40ull,0x903fff92c56629c6ull,0x0b496e3e73b93100ull,}, + {0x0f5622574884b369ull,0x48dc4ad8ee6e6c07ull,0x9bf8705b75932345ull,0x12fdae5ddc53fccbull,}, + {0xffbab25f3f4dbcc5ull,0x2e29054e3b0c795bull,0x4e42d9554507c4a9ull,0x0100c6ddccafa66full,}, + {0xd070c555e094dddeull,0xc33dd5eda3c03e59ull,0xaf83e343a270dd9aull,0x098aee3da1fa8162ull,}, + {0xad02918dc6d1048aull,0xf04903a09f8c1e95ull,0x51622aaf4848d918ull,0x1ded54a06c3901a3ull,}, + }, + { + {0x407e49d022ba5897ull,0xdb8d26843eab7b0full,0xf976a1b95413e184ull,0x0aec3abccfa3f870ull,}, + {0x5a796987e2623f7bull,0xf9ab67105d5e1b46ull,0x9d9d00cfaddf51aeull,0x1be8e30f8202ab70ull,}, + {0x793be4982c00e681ull,0x903759a9286f8a57ull,0x16a3daf170f851afull,0x13cf0c29956077fdull,}, + {0xfb5787f1092904dcull,0x9a7422c14149238aull,0xe8e61be7e9ad1fc9ull,0x10029d3e967eff2full,}, + {0x4a4887f39a050b1bull,0x2b7f2e2d718b7fa5ull,0xdcf39f9d5e4ccc87ull,0x0e9ae22b93f3c46cull,}, + {0xe2085144d647649full,0xbb22757ff04f1a8dull,0x39c323e34631d9f7ull,0x04865b0a1462c9b9ull,}, + }, + { + {0x684266fdd1482bdbull,0x49a7895fd6b87933ull,0x28476e848c17b925ull,0x19e95e89691c4ea5ull,}, + {0xe9a6a6bccaf53a2dull,0x479cccded58ddaccull,0x16049a3fd6291256ull,0x07364abc39086c40ull,}, + {0xf24da0fc6d7e4b82ull,0x29591202c08178e9ull,0xf9b5dff7dc07aae1ull,0x0ed06afda0a02f78ull,}, + {0xcac1c41fcc1f702cull,0x52b029719b5224f2ull,0xc838b665539d0364ull,0x246b61674cf835aaull,}, + {0x44068b26b9dce8e0ull,0x6b3a0b0e83a7c8b9ull,0x03feca47fb021110ull,0x10d9d6e7fbc944eaull,}, + {0x3a39ad7da63fd6fcull,0xaf3e9dde8885823full,0x31511af0a15648cfull,0x19de25d493f0200aull,}, + }, + { + {0xd4fff38e62012c13ull,0xae59ef30122850ffull,0x9d23a0381a012cf6ull,0x120ae1d814828c1full,}, + {0x42eb1c5dfbf07103ull,0xd254f031490046f0ull,0xb47882ae239b8ae8ull,0x11158120470a13baull,}, + {0xd5144f9267a09051ull,0x66da90aae84bab57ull,0x586fcfe6e1dfc445ull,0x221e49ed2a16e941ull,}, + {0xf467fe034d6cbdccull,0x7ac29c1d1e5e20feull,0xa110e6e05eb1585aull,0x23d954fcdf786a64ull,}, + {0xc1ae9be330026938ull,0x874b19ab11339205ull,0x0964cbafa59f62aeull,0x1e6167f38349f253ull,}, + {0x23efb445bd9ef627ull,0x897335bf70b7bcaeull,0xa00f86ae69e47650ull,0x2509e8fa87d5670bull,}, + }, + { + {0x22a00ec33abc6b8eull,0x09620addb21d394full,0xb965fdcb7ee143dfull,0x1febe6994e628a7bull,}, + {0x1c710a901e98b013ull,0x2801fd688f4dddf6ull,0x0abcab0ebadf8343ull,0x10f0cfd199338d92ull,}, + {0xd599e818b6e83ff6ull,0xb88539365c679f3eull,0x0313ce19b529a51dull,0x21f5f0b9f1cf3415ull,}, + {0xb59034f3ef13e954ull,0x6883ab623a40da9dull,0x94faebf81576de70ull,0x14d2247af37a0cceull,}, + {0x99757d5184162b77ull,0xf79b9dc74871c5dbull,0x608ad4501b03300bull,0x074149d915458798ull,}, + {0xa3252b36c3eda717ull,0xc1ded9f245002540ull,0x14b5755b56dac7b3ull,0x19308239f6756bf4ull,}, + }, + { + {0x07f4f5a6f26b067eull,0x32d2eb865477dbdfull,0x6945cbc86ac200a0ull,0x1e6311fd6ef61d2bull,}, + {0xa0d0920425c68e5cull,0x683d1987c8fe9e5aull,0xd7228b5e41a381faull,0x114a05f6a9f409b5ull,}, + {0xf677d47e68eeea17ull,0x87f50243b30d3112ull,0x084cf054770d8dc4ull,0x0bc9fe9990a74fb5ull,}, + {0xf22bdc5dc2eec0d2ull,0x3bae3de98c595ff4ull,0xc95e53073fd0b23bull,0x11a7e2b2d55a6ea2ull,}, + {0x8ddcbdbb83b870baull,0x728950ad96866c71ull,0xd145c1d31fae9c5cull,0x0547d0e831e70104ull,}, + {0xead79bef2b2433d9ull,0x0647d5966623bf56ull,0x4fb0056ba69d7958ull,0x1a0983813c5d2e9eull,}, + }, + { + {0x215a5a20e15d19d2ull,0xae9ceafe33084b69ull,0x80f85025ca380f77ull,0x1c19066c196d1a00ull,}, + {0x359cfc6bc545de2full,0x7339f8704a758d60ull,0x64eca98cd5f2d7edull,0x248ba44255247839ull,}, + {0xc2c6e70b389e8492ull,0xc9b97f7a19d874c9ull,0x87d7b9a332957727ull,0x0119950fe431afe3ull,}, + {0x51eeee98aaf4581cull,0x081de6981f8512e1ull,0x4bb18cf097ac6997ull,0x21e465b23c21951bull,}, + {0xe5bc584a9a1f5a1aull,0x1ccc4b14286b7ad9ull,0x435b382aeb470e64ull,0x1f9ae9143c5b987bull,}, + {0x990eccb3248cd3d9ull,0xe6cfbcdbd8c8fd0bull,0xb48de18c5009802full,0x198d98c5412a6213ull,}, + }, + { + {0x43cd5d8c9073ea61ull,0x5174db54059acdffull,0x45e871c04aa7a2ddull,0x05e16d3199d840a0ull,}, + {0x9ad1091f764df938ull,0x67637f20a74490b7ull,0xdbd73b8487d04861ull,0x15a139abaa8b478eull,}, + {0x1b10547972b4d507ull,0xf641d3763db1a739ull,0x15597787c5b84ec3ull,0x0134b78ebf335c12ull,}, + {0xf6b7a9d4052963daull,0x2d806855d9466783ull,0x623658a8a2d743dcull,0x00de0208fc0298b1ull,}, + {0x1b67ee84e8c40714ull,0x620107f4c2393038ull,0x96441ca3a07baeeeull,0x0b27368271b0f683ull,}, + {0xa65922c66ed876ebull,0xdc21179aa8971bdbull,0x9309a00b5206e041ull,0x088fc38497bf88ebull,}, + }, + { + {0xee8bf43d2fc34584ull,0x4ff6772e8da82b6bull,0xa7ae3c97dc955a78ull,0x09651f34f9ad7ab5ull,}, + {0x103de2e1906f8fd3ull,0x046ca4e6b276642full,0x220398cd397af5fdull,0x07b984811b0df962ull,}, + {0xd0519e42b872b7aaull,0x164acb4f7d9df94dull,0x54cd157448c94337ull,0x04c636efd3f59641ull,}, + {0x7cf41f52f0acc90eull,0x54dff80755d46315ull,0x83a7e3f528daec19ull,0x0039b02577bb91e6ull,}, + {0x828eb12b537a9732ull,0xd81ce0f79c6211ccull,0xcd2fd2f2e35379adull,0x1e84fa2068841dd3ull,}, + {0x931aef70f9a3a06dull,0x71abc5af88fa12caull,0xa70ddb3102a75247ull,0x14a049c881169cceull,}, + }, + { + {0xa9975bec6d3f0412ull,0x72feab9fdc81092full,0x49f533cdb7ae9d66ull,0x18632a2c4c5b4d2dull,}, + {0xaa9f81eeb706ca09ull,0xb1065065a3fe5198ull,0x3381765974ac94a8ull,0x0ec5d52c65b1f5e0ull,}, + {0xfe465050a5cd7ab1ull,0x5059fae63d47120aull,0x49ad1fd731ef0aebull,0x1e018673e33f45e5ull,}, + {0x6eebdeb52c24d248ull,0xa43988a55ccc8d10ull,0xe997fafe55d0ff64ull,0x233675abd5ad14e6ull,}, + {0x8b5530b175fbeaadull,0x27ba08984164ed08ull,0x94a9507d0189809dull,0x12fb832d1d13901cull,}, + {0x912ff6e6cf0c29f4ull,0x54d7a43121bcd1afull,0xcdf9fb448a1e2185ull,0x02aac1a8e253b8f9ull,}, + }, + { + {0x26a581d7ca270a84ull,0x989bddaaecea533cull,0xda7993327a4b8cddull,0x0c1637ca7d045160ull,}, + {0x6213cd9db7a6d076ull,0xc03037d124aded7bull,0x32d9e1bd41523d2bull,0x008ea641abbe75edull,}, + {0x7d3c23b227774f03ull,0x4a5e7805e6f9a14dull,0x1c24f1a43d487e79ull,0x18eafaffc703509bull,}, + {0xe146113f559bd9efull,0xe56825b1a7fcf7f5ull,0xa93689399f819fceull,0x14fa96013c5a6638ull,}, + {0x81c625bff8857fe7ull,0xc98edd68e7203a68ull,0xc88c3a681a3f1ac1ull,0x0bd4fa57e9b6d9f4ull,}, + {0x2dd6eb21127b1fefull,0x91b039a57e0f6233ull,0xd02548bc3dc3c783ull,0x0e8a4d19a777a688ull,}, + }, + { + {0x025c54533652a519ull,0xb3bcbf01559e8920ull,0x5c53eb97c55f25fbull,0x22322b9402949dccull,}, + {0x260ef92c70dd5c11ull,0x9e27626b6cd441acull,0xc6661507ed6f5d61ull,0x0fac1fb2f6bb53edull,}, + {0x5511ab3bd7ea4c51ull,0x6562a46409240916ull,0x83a5e441731b870dull,0x205c0c853ef83501ull,}, + {0x7c8ae57f4deec828ull,0x349dd08555bea497ull,0xcb5d3234c7b839bdull,0x153259da7d31993eull,}, + {0x964b508f6fa5bb3full,0x82b5262f18242750ull,0x970156d1896d43c2ull,0x028fc28439e44783ull,}, + {0xda5afd0f1a7d7fcaull,0xddb473f9a75a7a4cull,0x180c169ed34f6781ull,0x0cde138f3279be8bull,}, + }, + { + {0x63de6da225c321ddull,0x4832886b582d3833ull,0xb0dee708e55cb53bull,0x06c9e933c223ec30ull,}, + {0xdab1fab5dd78e263ull,0x3e658d3d9ec3bb7full,0x3d0a56ca4a1b088cull,0x008ce74540e8386dull,}, + {0x0b0ee452fc9bca4bull,0xfd0b0e032d16b266ull,0xfaeea7076b32cc91ull,0x1823f6048f88ea5cull,}, + {0x3966dc6553a5ff08ull,0x85192338024e75e5ull,0xff2cc296f92beee4ull,0x229caca8d4f809ffull,}, + {0x7702729e0d1f5157ull,0x1a3ac2432384d0bcull,0xd006954b39b11e9cull,0x118a5126dec2a2faull,}, + {0x2e9bfe6eaf026413ull,0xc720a61aef11d653ull,0x6ea67c87c36691a3ull,0x18f925014f9c61d4ull,}, + }, + { + {0xd3b27621ad1dd1abull,0xf97b0f55f22f18c9ull,0xb6113e8be6db1114ull,0x1a8a1ae8f65ead1aull,}, + {0x0007a32980115669ull,0x605196cb02f760a8ull,0xfbd2085c8671df43ull,0x0c381e59ea5960d2ull,}, + {0x94116d83a9603b67ull,0x92b23f61ccedfbbcull,0x50e0fc7e78727f5eull,0x23fc01a1d8cc7e65ull,}, + {0xd1b8a0d5024aff36ull,0x2b25d1cf4ab60e92ull,0x8dbbaf91e20c91fbull,0x185a985f30c061fcull,}, + {0x06fe112b333faa7aull,0x9323dbd6f08549bfull,0xcf5e43f668844df0ull,0x10df0c27f29e1637ull,}, + {0xf2afbd9928527e7dull,0xd856c6d7448b34ddull,0xc5e025621b375c86ull,0x01b0fe70c9b177dcull,}, + }, + { + {0xf09e65fdda5bf41cull,0x59ef2a8eb45985f0ull,0xfec4facae20ae75full,0x019f623d519953a8ull,}, + {0xd5dc50c38c7e165eull,0x62fc39995a53fcf4ull,0x557a7e55f3ae1284ull,0x0fde40ac729d9ca2ull,}, + {0x4b49ba1f5fcea25aull,0x631dbbd1d4e3cea5ull,0x7069fcd00919239full,0x09c559fb76aa0dbcull,}, + {0xbb6348d2d3a8d733ull,0x460c7255ba85e5c1ull,0x42e7d9808787c01cull,0x22c0fd2eef2261e2ull,}, + {0x19833887b93cc3abull,0x2cee6551569164daull,0x1c44fdcd7b0c79dbull,0x1807ed58575a7b33ull,}, + {0x30713388923e3b7eull,0x6d541ffc75d914c7ull,0xbbb50245851f0f6eull,0x1df0abdb9048edc2ull,}, + }, + { + {0x62788c325d2b0f0bull,0x33744819eb512733ull,0x83ff060d6ff7309cull,0x18829912bda99968ull,}, + {0xe09edb24cdbdfc6bull,0x099200c5850fc442ull,0x967790a56049a66bull,0x011cd382712b1d77ull,}, + {0x8df4e975f64427d7ull,0x2e3901a3a7b0f55dull,0x641ec6f45805e402ull,0x06e1d0db4022cd43ull,}, + {0x440dbd8590564164ull,0x6aa7d9c34c053da4ull,0xe0da2752be2f5aaaull,0x2264f00ad93d3d4aull,}, + {0x716e5f9a7e68031full,0x1bcb15653094bebaull,0xf84ac39bc138e963ull,0x1d7a1fc06adf5b63ull,}, + {0x8835962eb2e3079dull,0xc3d7c9d41261e319ull,0x30c0c53b9353bf58ull,0x03bf957dd1541c99ull,}, + }, + { + {0xe77e8891944694ccull,0x04efd57869ed85ceull,0xe9de08ffa6a88729ull,0x1d062265f1d299d3ull,}, + {0x387dab533dc83cc8ull,0xf7fa09c0bbdf31b7ull,0x59b84e1a3762d3b9ull,0x01b32660eab7f6beull,}, + {0xf7daf1d596d17df2ull,0xcd931e51341e0ebbull,0x51710bb172705525ull,0x244d6b81dbc7d273ull,}, + {0xe7a144e6eefd2dc8ull,0xf5c76e992d995cabull,0x477afe1374a66f3cull,0x1aebe5717b54fe53ull,}, + {0x541a0d7dc825c3b1ull,0x93a0cab475598133ull,0x096efa1eb12a99feull,0x17a85ece29f273fbull,}, + {0xa36f4f86b5bc5c1bull,0x1b4a0fc57947e76bull,0xaf302e3f7838388eull,0x06aadb4991feff1full,}, + }, + { + {0xd6afd4710167605eull,0x1897263cb81c98e1ull,0x90e133c23eb0207eull,0x0718643da3a96ba2ull,}, + {0x8344e521afad71f8ull,0x66af04f81ad9f156ull,0x5ecd25d48f404733ull,0x0234ffcdbb42d141ull,}, + {0x8a50c65ef686166dull,0x34cdda95694e0cacull,0xa8add01d08d2dbaaull,0x1ce98a7c6ceb5696ull,}, + {0xb1702710fa0af484ull,0xe30a4eb2f39aa3f1ull,0x7409d5afcd96441eull,0x1e0168166b2894d7ull,}, + {0x8cfa29792abed76aull,0x75d7bfbcee2073efull,0x7c0372e7080fdaedull,0x1ee8cc19eb967336ull,}, + {0x2a265f9eb8f2265eull,0x48f9b13b07b728f5ull,0x7b915e1225774e84ull,0x0d4eff23e23d5ae3ull,}, + }, + { + {0x13cc952b1ef56e58ull,0xeb3870335e75a7c9ull,0x2fe15087e3c0845bull,0x1011a2007bc71f04ull,}, + {0x472e18f407707bbbull,0x053d1dd70cceea98ull,0xe200cdc8798603d2ull,0x0bddb233bffdfc1aull,}, + {0xec920181b8484410ull,0xc6b9a9b74e18f513ull,0x84c1695c77cf9fc1ull,0x01005eda69cae7ceull,}, + {0x7c668bd94e95d9f5ull,0xbaf12b0a06fcd749ull,0x674b2e2824d6029aull,0x23c9d63fdca6307aull,}, + {0x92bd96dd3a545dceull,0xccb9355edd49cadcull,0xf49ca3d068b74eb3ull,0x1d9461936f823b86ull,}, + {0x6a2fa39fa7e93bb3ull,0x468fac8c8f151f41ull,0xd12e0aec4bb21bbeull,0x2326bbeb4405b3ebull,}, + }, + { + {0x1e029295309f1347ull,0x6589babde3a80cdbull,0x74de96ccf73da639ull,0x125810442f8c9fbaull,}, + {0x47d63700da3a6cefull,0x59c3fd0f2b9b6f35ull,0x66f1979c84873b7eull,0x02770c35ac617c99ull,}, + {0xa757e064e4f9edb2ull,0x46eb13ddfbda28f5ull,0x519177520a694aabull,0x04f6097d775debf9ull,}, + {0x072be9865dd6841dull,0x4d9d5c0fa6d6a7b1ull,0x1749ea911a952c21ull,0x15e98445e982607eull,}, + {0x6fb1b6845ce93f6dull,0x52d5387b1a0f8405ull,0xd6a11cff22d72a42ull,0x2283db33f8496ec9ull,}, + {0x77bae4ccdf2e5bf6ull,0x21812c170f736a30ull,0x5a8477a3203036fbull,0x1e667d8ca4a419f4ull,}, + }, + { + {0xfc925115198c93d4ull,0x0aebd45cf3b16db7ull,0x2f7c3d2ab0f16732ull,0x1c4b48273365c9bcull,}, + {0x2a26617f1f00e47full,0x828f68381a20ae68ull,0x0221e65b7f01b6e8ull,0x19e45e14ca4e5650ull,}, + {0x231de599fda4c7e2ull,0x55e6d0d3df2457abull,0x34f961f715fddd4aull,0x0e97e5f5fbfe6aecull,}, + {0x8f1f1a8b1b687949ull,0xbcbdae7ed35524edull,0xd7c78090035aa0b8ull,0x19f2a0d7fb844166ull,}, + {0xc397557bba8fe6a4ull,0x366daf415604f8f6ull,0xa9b99d86ac93e705ull,0x21fb72d548929de6ull,}, + {0x6a2ff9d0392aedf0ull,0xb0a90a0d10fb8fb2ull,0x5ef8e1768350ba26ull,0x24aca64027557318ull,}, + }, + { + {0x18e3eeb6b8937690ull,0x7c87ee4ffda9eb41ull,0x59d0d9e9eb070efdull,0x10b64beb52f348f5ull,}, + {0x60cb09b15da28d99ull,0xde4b5aaff3981423ull,0x7429b4169dfddfb9ull,0x199eb1a7a6de0f9full,}, + {0x450661858d54325eull,0x338439f5a896f88cull,0x9d41086dd111bec0ull,0x146d0b19b0b567ddull,}, + {0x93a470115d0544ceull,0xdbec88b263d6ba96ull,0x4162857e9d97ef77ull,0x07a4e45e194880aaull,}, + {0x7279bdde87e7ecb8ull,0xbfcc34d54c72df15ull,0x57d3ff1a2476f6c9ull,0x0f0da2351d32d405ull,}, + {0xffee1be1efc73104ull,0xb873a987a8076cb4ull,0xce026a94aa6b71f0ull,0x15d4bd558bf59554ull,}, + }, + { + {0xae631a8d76bd7f86ull,0x7e7d9176acbc845eull,0xea421fd87eb8808aull,0x20aaae552a029015ull,}, + {0x5c1c015cfce07393ull,0xc678b97a85aea9b0ull,0x1eea5259304f0a23ull,0x1464e4d058ceb8caull,}, + {0xc65d3f2d4e51915cull,0xeedd92d9fe368d68ull,0xc8df47e3a123fc9eull,0x0a40dfad54ccd6aaull,}, + {0x09a262e9428a05f8ull,0xa0510048ec69ab80ull,0x335a295aecb01ddbull,0x05d9e955d5b1a89full,}, + {0x5eb68ea11c52c37aull,0xe444556824dd8a88ull,0x8e380018a6aeef10ull,0x0442ce4eda39623dull,}, + {0xa77e431b883ec5b0ull,0xac34fb82921e9c20ull,0xa8cfc2d08ef8cfc0ull,0x24ae732a4db3bb4full,}, + }, + { + {0xd5563857f984777bull,0x538e5c618a4be3c1ull,0x5f8eff3fbeab5a7eull,0x017bdafb790e0102ull,}, + {0x6a62e076dc44c251ull,0xd4743cd8eb4cb3dfull,0x98f0d5617f07650full,0x0ef52eb4c0151010ull,}, + {0x516284d618713c13ull,0xe651d8c5769b47dfull,0x27fb0f16b90bfbdaull,0x10e729bd4403fe24ull,}, + {0x7770b670be42c842ull,0x6a9d9db10a3626b9ull,0x17676416c44a62ebull,0x2155a03fd59945caull,}, + {0xcd58941a2ba1e208ull,0x2d5e3caf14827df1ull,0x6e8dbafadc4e1635ull,0x03bbd3e6d397465aull,}, + {0x451703d643a411bbull,0xcca0c1d97355c175ull,0xc5074f56618aa2f1ull,0x04c8acdd37ef602full,}, + }, + { + {0x3f7e0caeff75a1d9ull,0x1b753ba68a2b8451ull,0xf46aeda408dbf4f5ull,0x11652b99c4365b3full,}, + {0x3f8bf5f03132d146ull,0x0b527b11a12d2424ull,0xd587034aa3632352ull,0x13ffef8175d1a563ull,}, + {0x2a30747e4ac8eeaaull,0x0aea36171552eed3ull,0x04e341313ec7b422ull,0x1fb62ea6d5e86357ull,}, + {0x13c69094d2dcc5aaull,0x54573685ddc44032ull,0xd95abdd392375f10ull,0x13a501913c2f1d0full,}, + {0x343cc1b0318577b8ull,0x98776ba96045eb10ull,0x5492dba5b5936d5dull,0x1d1bb567d6a602e6ull,}, + {0xccf58e05f8b305bdull,0x3fee26e8419548ceull,0x62c64af67fc27dc8ull,0x08456a814b2fe18bull,}, + }, + { + {0x47f8ccf69457895aull,0x66d08f143ca062fdull,0x8f0df2e2a97b4518ull,0x0cac6d2b34b243d6ull,}, + {0x758f56a94a45e6beull,0x63ed30c20cf6721cull,0x20e942550629c9ccull,0x167acfffb8203274ull,}, + {0x8e727dabacc57eb3ull,0xa2f85144ebbe15f3ull,0x7fc17e7a0a6a4291ull,0x1793c43f349e48b8ull,}, + {0xed2f91d056a5c2d3ull,0x30433d773122e8ddull,0x2c3fef6399c4f9deull,0x099b39a0e3e524f2ull,}, + {0x4cddac568a4b563cull,0xdcd1c44d3983138dull,0x2f421d9f8d71a88aull,0x01a02cb6459cdb12ull,}, + {0x68c09ced7ae8977dull,0x76cb2bf3a933cdaeull,0x6390cd95c4f85d40ull,0x1cad79870e6b2c2cull,}, + }, + { + {0xfd754584dcb80db2ull,0xb73ea36e2df2b8c0ull,0x3ca5645bffb60c04ull,0x1280d1e1f4dd4da6ull,}, + {0x75a069b69ae4403aull,0xbbf6c5ded1f82c60ull,0x34919f2295d7b5b4ull,0x1f7bc94e3a96507bull,}, + {0x9255ca27cb288f9dull,0x760719cfb400f56full,0x291bfbf807781368ull,0x15fa25b272fee67eull,}, + {0x6054f038190f5f6cull,0xe0978a57792a09bdull,0x1ed22ba69556fe50ull,0x20ba270b20baf856ull,}, + {0x55de530a1af249d0ull,0x249e57b2414ceb2cull,0xd98bdcde7f16edfcull,0x0ee1bfb7da744ae4ull,}, + {0x01b24c4d0bb96ddfull,0x32239e98244d75f0ull,0x20dc68759c157d45ull,0x0120769b781bc14eull,}, + }, + { + {0x4f93886e58c4695full,0x85d6a1914aba1d04ull,0x65bb00f8cf495806ull,0x22a2413c698ae97aull,}, + {0x5e7928222bb02f69ull,0x93a92c850ce1dfb0ull,0xab3eda670f968b1aull,0x1d80886e0fba63ffull,}, + {0x672372572dbdeb59ull,0xba4cd6dd6cb11489ull,0xc74f1c6e3b714d1bull,0x1680ad98da380987ull,}, + {0xbad24d644fd9ab88ull,0x5c817abf11d3ce46ull,0x50587e12664ad6ebull,0x13505c240ec7b092ull,}, + {0x69ade81d2b6d1284ull,0xdd1d9aacd53d3f77ull,0x0888b2de31545a07ull,0x110788f6944c78e4ull,}, + {0x81032f6ea72116caull,0xfcb0253b20bea779ull,0x3d0a38d424eba36eull,0x07bdfcb51526c1e5ull,}, + }, + { + {0xebb80cf2cf44bfbeull,0xb8d559e318097038ull,0x212ed4c3d148be8eull,0x07028dcc862fbbb7ull,}, + {0x91e0a395d89f04d4ull,0xf777ae0142ff07c1ull,0x546b9b47f738fa6eull,0x01c284ef516920c6ull,}, + {0x2042edb5a4eb2cdcull,0xc69cefe0a36a7068ull,0x54471d65b3238311ull,0x077562b3344b4304ull,}, + {0xdb85089b11ece88dull,0x5c27780550f90569ull,0xb9607c12434a6b3dull,0x0d02a6324718f932ull,}, + {0x22ef9b5c8b453c5dull,0x6fdc3875e9247830ull,0x20e375065f9e593aull,0x2351c044ce0d933aull,}, + {0xfa0fcb482093eacbull,0xf8d695e8413f5acdull,0xc7020d8c84a2d773ull,0x11bf7584e5283fa1ull,}, + }, + { + {0xc6b304aa2adf2dfcull,0x19aac2d5544ee834ull,0xb7966f8cd629c330ull,0x1bc72a08a8bf8f9bull,}, + {0x18a5f463799112c7ull,0x4f14db51e967ebc3ull,0xa5ddb48f64db5e8eull,0x15b4fdd8610f3a32ull,}, + {0xe7b86b479d7e2293ull,0x931034487abf490dull,0x8c40ab7dfd28a196ull,0x1d981d3918fdc3b5ull,}, + {0x00797000c2afd324ull,0xf2954f0f86622806ull,0x8464fe0995cd3a7dull,0x0f0a74df4ca00cc3ull,}, + {0x639707b1839c8330ull,0x9c8d491ad7d779a9ull,0x576b7e0f24ce5f46ull,0x21fbdcc42ccd04c2ull,}, + {0x4578db4bdfd55434ull,0x1126933c97e9f4dcull,0xe64529a8921d7415ull,0x12e48bab87ea1fe3ull,}, + }, + { + {0x3f6d2fd04bd5ed75ull,0x65e464cdac7d235bull,0x45903a63a3608961ull,0x1f60c825bccd55c9ull,}, + {0x36b33d0fb8528047ull,0xc8d1f1ad82683baeull,0x78f4b80065c2e4c6ull,0x2066f32874bd1228ull,}, + {0x8b6d6a4b986e8d4cull,0x58f6f275f1d020f4ull,0xe4f3c16209e87ad5ull,0x1cdc33d41ad30173ull,}, + {0x9ec18a6cba3fb3ecull,0x31fc74b68ac834c6ull,0x256788ece76e37b0ull,0x13de6919841928e1ull,}, + {0xae46aa08773971f6ull,0xacd04d9698d47643ull,0x3667178a594f2153ull,0x19a0cadfa3cb7fa0ull,}, + {0x228420456325e079ull,0x3e4ec53c418fdae9ull,0xb9fee919e867c6f1ull,0x2272413f3e989842ull,}, + }, + { + {0x6420ee94e7c764dcull,0x87b3c986d488deecull,0x11dc3e6b59de7ffbull,0x14bb613bce5792e2ull,}, + {0xcc0b60cd4e352976ull,0x794b585f70a5b463ull,0x415cb954036ba631ull,0x1e521f8201ca4258ull,}, + {0xd707ac91ecd5dbdaull,0x08ffd44e5fd83cc6ull,0xa5f39e0f8dff5afcull,0x02315f6a55599212ull,}, + {0x2cdbd9f11596e797ull,0x7c560adedcf2cb25ull,0xdc474409e5650d9dull,0x158bc955e7e492e2ull,}, + {0xd6023b14352a1766ull,0xd5c271d942b6541dull,0x5dc4d1c72d25258full,0x0753f065a4cb028eull,}, + {0x11b4229a4c62010aull,0x2949cb6b089b3aa9ull,0x01b8bdc50766366dull,0x1094dfda1e2e5e57ull,}, + }, + { + {0x773cc6e1ac12f73eull,0x77686f8d75a83e9eull,0x7ce94b7ef1bd53a0ull,0x005a7d3e75c16332ull,}, + {0xafdc64df2ceca388ull,0x15be551bbca0e367ull,0x62d9b7608cf3b8a2ull,0x11ddfe7a0a96af25ull,}, + {0x5d23851a77554f67ull,0xa0f51815094e8050ull,0x930af7569c7850d7ull,0x108eb034eeda1460ull,}, + {0x28a80b277688cae3ull,0xd09ef5d30ec9b193ull,0xb6c554e32540d421ull,0x1da12923355fd2faull,}, + {0x9db6509d0130494dull,0xe28936417c250459ull,0xde8b4491aa8d1dc1ull,0x194b8e7bfc005322ull,}, + {0x7aaeb4f2f941741bull,0xf9d7b55b452158f8ull,0x17e172a187f68105ull,0x02f620bde277950aull,}, + }, + { + {0xf555a7766ac21481ull,0x82b12050c9449770ull,0x7bd16da27eff49fcull,0x06d1ad9a6cd69b71ull,}, + {0xa059542aa0f64e9full,0x93671f16b269a351ull,0x795262fddcb7cc3eull,0x199f355d6263cf86ull,}, + {0x0cbf707f1f8f73aeull,0xf483501e15982b44ull,0x2456aaa4d84d80c0ull,0x0d0ffb5393f7dd0aull,}, + {0x62999996c09097e2ull,0x1b87e828f9fc66e4ull,0x6b17eb3166967f57ull,0x1603601303478f52ull,}, + {0xfb776d4fd407d485ull,0xac03efdb746bf127ull,0x57bde58a5671a601ull,0x0cfbfa20d141f05cull,}, + {0x625ac1161752cbe2ull,0xe3348570b6ad71bcull,0x155b3911f5335f75ull,0x1679ec68122edc64ull,}, + }, + { + {0x9334b4c82aee3ef8ull,0x7ea393af9d865ce4ull,0x0f4ee0906b864850ull,0x1d9e34461e27cc61ull,}, + {0x921b1a6aa179a081ull,0xcca25db2d609388dull,0x816b69ad9a56a314ull,0x00eb3f6388c4d375ull,}, + {0x04e25f4225e50e72ull,0x59a20b6edf897f2aull,0x0842d5f5823535b4ull,0x0dceaf5ae8e50885ull,}, + {0xac6598257175aa0aull,0x1d5d21e8129f2efaull,0xe81dcc9497cb17fdull,0x11327c40c92dff80ull,}, + {0x149e4b2c0a3bfd81ull,0xb8efe68c475436ebull,0x3a8bf06e9ca15cd8ull,0x152d72639c6e5308ull,}, + {0x217e0e34f3f76b8bull,0x5c722d926b596985ull,0x45417905be08807bull,0x1e6132b54ad5595eull,}, + }, + { + {0xe5b541097726667dull,0x5583dfb4ade471adull,0x1840bff44a2faef2ull,0x093c23f8028fe3b9ull,}, + {0xe1e3347370f6e6c7ull,0x8dd7352c4dcc2a17ull,0x3cade218210f9e29ull,0x190ff57eac6e8b87ull,}, + {0x34905e72c173fdc3ull,0x59f8c6f4373c834eull,0x1bd9feabed806c99ull,0x1f209a7935a8ba38ull,}, + {0xe44f080023c83b49ull,0xfd2006276058693cull,0x44b43b6e462a32cbull,0x0942a0ed8e4657ebull,}, + {0xf7e53796340fd772ull,0xf8219ede4152370full,0x548b9b002c19940cull,0x1d0aaff93f50f52full,}, + {0xb5987eb545462ddaull,0xe0f29867116336edull,0xcc75a11c3ff8374aull,0x144d0b8fda0a44a9ull,}, + }, + { + {0x676408d2ff1a7593ull,0xc96a8077d911776full,0x9efff30500904c63ull,0x100a6093df2ae343ull,}, + {0xf1f92502b846cf30ull,0x57888806036aec6cull,0x310ceb0b04caaa7cull,0x1192819a3058307bull,}, + {0xbbf882b39fec7883ull,0x4079d241f7e6e0efull,0xb3090a69b3c7261full,0x16440a02d7fb5d2dull,}, + {0x70e9c8a88422df45ull,0x48fa15635ca49bd9ull,0x0430c461bfb96d16ull,0x0a29a4007c99f6d1ull,}, + {0x643a2bdb308a297cull,0xe4a5bca158e65ff6ull,0xc8dd1579abdeb9e5ull,0x1ee4a94b3d6c775cull,}, + {0xc085b2622b5c4480ull,0x8c69048c5fcded96ull,0x418ba7bd3260d85dull,0x0b22158bb6c29f9eull,}, + }, + { + {0xf661abe667e83f01ull,0x41068a7e95fd10c0ull,0xc9c4cc186cb3eb72ull,0x1a95a93a30592461ull,}, + {0x78dfc65c7280895eull,0xb9f1514b98add459ull,0xc7d713fd92025a11ull,0x0dbe6c1ceabcf73full,}, + {0xe35368a946428244ull,0x990da5e2783a2762ull,0x686b61b7775fb02cull,0x1a79e39b78922172ull,}, + {0xbf8ca28c8d95600full,0x0f56487a909e51cbull,0xfa1da11e3018a2faull,0x07a32571b231773cull,}, + {0x46c84d812bce56f5ull,0x84aa8d8bfe2b498cull,0x699ad1f34e22d74cull,0x0ad743bd99c458dbull,}, + {0xa8d16c7e09aa59b0ull,0x59ba8cbe75f31d51ull,0x5c68705d7838ff4eull,0x1c863feb5090e87eull,}, + }, + { + {0x86af66313ed193baull,0xa0902147163778b5ull,0xa101fcdc6b2d6191ull,0x12fbff4713e6eb10ull,}, + {0x9e1abdaf6e329c66ull,0xd8de2fb4db8e7554ull,0xb4374e1e93a0171bull,0x0ba2ecd00749208full,}, + {0x0cad8f57c02ce090ull,0xcac04eddadd338ecull,0x7ee5c235934f9918ull,0x24db5a9b0ad7ed64ull,}, + {0x46288ad8e01c5063ull,0x4b4c58654226c44aull,0xc4974aaf56ae42dfull,0x173e64cdd5661536ull,}, + {0x58b3450781e7e080ull,0x14ab3a25a5e64bbcull,0x3f9f91743276d2f5ull,0x0e101d0b89b81cdcull,}, + {0xa6bca5fbe99b2b7full,0x5fb8817e670ef40eull,0xb44cbcb05de76cb3ull,0x17110ed4912babb5ull,}, + }, + { + {0x6745e77f4e05d8edull,0xed278e7875ebb5fdull,0x3662f60864a8ccd2ull,0x028104ffc0a31868ull,}, + {0x740b76d64f25c9f0ull,0xb519a415132160e7ull,0x550a38ed829c5f68ull,0x04ea27d6deefcfabull,}, + {0x32d82ea897185651ull,0x04a8f5b63a90573aull,0x2c88fdfba241b62full,0x0285780fe0b77687ull,}, + {0xfb6ebce4f4b20f13ull,0x8ce24ff3dad1a3c7ull,0x716f93b316af50c2ull,0x0a09e678713447efull,}, + {0x6868a19728642ca6ull,0x4be5579c08e0a30cull,0xbd630b8f9c3d1552ull,0x0f277cf26c8e60f2ull,}, + {0x1a105d54bc290b18ull,0xa7e1a7c716529370ull,0x6e5a6c5b44350fd0ull,0x1fd2ae638488fccbull,}, + }, +}; +#endif |