precomps.mx raw
1 package secp256k1
2
3 import (
4 _ "embed"
5 )
6
7 //go:embed rawbytepoints.bin
8 var bytepoints []byte
9 var bytePointTable [32][256]JacobianPoint
10 var bytePointsLoaded bool
11
12 // getBytePointTable returns the precomputed byte point table, initializing
13 // it on first call.
14 func getBytePointTable() *[32][256]JacobianPoint {
15 if !bytePointsLoaded {
16 var cursor int
17 for i := range bytePointTable {
18 for j := range bytePointTable[i] {
19 bytePointTable[i][j].X.SetByteSlice(bytepoints[cursor:])
20 cursor += 32
21 bytePointTable[i][j].Y.SetByteSlice(bytepoints[cursor:])
22 cursor += 32
23 bytePointTable[i][j].Z.SetInt(1)
24 }
25 }
26 bytePointsLoaded = true
27 }
28 return &bytePointTable
29 }
30