Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 5ba2de2

Browse files
authored
Merge pull request #9 from drand/fix_signbe
fix signBE old behavior
2 parents bb1e089 + 0845509 commit 5ba2de2

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

.circleci/config.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ jobs:
77
docker:
88
# specify the version
99
- image: circleci/golang:latest
10-
environment:
11-
GO111MODULE: "ON"
1210

1311
# Specify service dependencies here if necessary
1412
# CircleCI maintains a library of pre-built images
@@ -18,10 +16,5 @@ jobs:
1816
working_directory: /go/src/github.com/drand/bls12-381
1917
steps:
2018
- checkout
21-
- run:
22-
name: "Setup custom environment variables"
23-
command: |
24-
echo 'export GO111MODULE=on' >> $BASH_ENV # Redirect MY_ENV_VAR into $BASH_ENV
25-
# specify any bash command here prefixed with `run: `
2619
- run: go get -v -t -d ./...
2720
- run: go test -v ./...

kyber_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,10 @@ func TestKyberMap(t *testing.T) {
327327
expBuff := []byte{181, 210, 28, 109, 17, 179, 69, 136, 116, 26, 243, 48, 174, 161, 221, 170, 166, 117, 230, 82, 140, 126, 110, 159, 57, 19, 243, 7, 38, 137, 81, 34, 174, 180, 182, 210, 238, 114, 101, 200, 81, 127, 63, 170, 73, 213, 21, 85, 18, 61, 232, 226, 86, 7, 172, 113, 197, 213, 56, 135, 54, 170, 169, 14, 222, 79, 241, 126, 195, 10, 81, 174, 166, 210, 93, 156, 49, 6, 180, 236, 64, 89, 160, 46, 10, 167, 130, 6, 164, 183, 65, 210, 206, 221, 206, 246}
328328
require.Equal(t, expBuff, g2Buff)
329329

330-
g1 := suite.G1().Point().(Hashable).Hash(msg)
331-
g1Buff, _ := g1.MarshalBinary()
332-
expBuff = []byte{150, 231, 171, 210, 107, 209, 224, 216, 101, 98, 109, 77, 204, 113, 126, 73, 8, 124, 185, 124, 96, 92, 42, 107, 94, 144, 249, 53, 19, 125, 129, 233, 243, 253, 146, 1, 74, 38, 20, 245, 206, 63, 87, 254, 52, 237, 14, 1, 227}
330+
//g1 := suite.G1().Point().(Hashable).Hash(msg)
331+
p, _ := NewG1().HashToCurve(msg, Domain)
332+
g1Buff := NewG1().ToCompressed(p)
333+
334+
expBuff = []byte{150, 231, 171, 210, 107, 209, 224, 216, 101, 98, 109, 77, 204, 113, 126, 73, 8, 124, 185, 124, 96, 92, 42, 107, 94, 144, 249, 53, 19, 125, 129, 233, 243, 253, 146, 174, 38, 20, 245, 206, 63, 87, 254, 52, 237, 14, 1, 227}
333335
require.Equal(t, expBuff, g1Buff)
334336
}

swu.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func swuMapG1(u *fe) (*fe, *fe) {
4545
}
4646
y := new(fe)
4747
sqrt(y, y2)
48-
if y.sign() != u.sign() {
48+
if y.signBE() != u.signBE() {
4949
neg(y, y)
5050
}
5151
return x, y
@@ -109,7 +109,7 @@ func swuMapG2(e *fp2, u *fe2) (*fe2, *fe2) {
109109
}
110110
y := e.new()
111111
e.sqrt(y, y2)
112-
if y.sign() != u.sign() {
112+
if y.signBE() != u.signBE() {
113113
e.neg(y, y)
114114
}
115115
return x, y

0 commit comments

Comments
 (0)