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)
| 55 | // must ensure that buf has enough space. If buf is too short the result will |
| 56 | // be incomplete. |
| 57 | func 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. |
no outgoing calls
no test coverage detected