[Go] Use BYTES_PER_G* instead of 48/96 (#284)

This commit is contained in:
Justin Traglia 2023-04-07 07:57:27 -05:00 committed by GitHub
parent 5d4f6efbe7
commit ae2db332a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -78,14 +78,14 @@ func LoadTrustedSetup(g1Bytes, g2Bytes []byte) error {
if loaded {
panic("trusted setup is already loaded")
}
if len(g1Bytes)%48 != 0 {
panic("len(g1Bytes) is not a multiple of 48")
if len(g1Bytes)%C.BYTES_PER_G1 != 0 {
panic(fmt.Sprintf("len(g1Bytes) is not a multiple of %v", C.BYTES_PER_G1))
}
if len(g2Bytes)%96 != 0 {
panic("len(g2Bytes) is not a multiple of 96")
if len(g2Bytes)%C.BYTES_PER_G2 != 0 {
panic(fmt.Sprintf("len(g2Bytes) is not a multiple of %v", C.BYTES_PER_G2))
}
numG1Elements := len(g1Bytes) / 48
numG2Elements := len(g2Bytes) / 96
numG1Elements := len(g1Bytes) / C.BYTES_PER_G1
numG2Elements := len(g2Bytes) / C.BYTES_PER_G2
ret := C.load_trusted_setup(
&settings,
*(**C.uint8_t)(unsafe.Pointer(&g1Bytes)),