MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / readBits

Function readBits

crypto/secp256k1/curve.go:57–66  ·  view source on GitHub ↗

readBits encodes the absolute value of bigint as big-endian bytes. Callers must ensure that buf has enough space. If buf is too short the result will be incomplete.

(bigint *big.Int, buf []byte)

Source from the content-addressed store, hash-verified

55// must ensure that buf has enough space. If buf is too short the result will
56// be incomplete.
57func readBits(bigint *big.Int, buf []byte) {
58 i := len(buf)
59 for _, d := range bigint.Bits() {
60 for j := 0; j < wordBytes && i > 0; j++ {
61 i--
62 buf[i] = byte(d)
63 d >>= 8
64 }
65 }
66}
67
68// This code is from https://github.com/ThePiachu/GoBit and implements
69// several Koblitz elliptic curves over prime fields.

Callers 2

ScalarMultMethod · 0.85
MarshalMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected