PaddedBigBytes encodes a big integer as a big-endian byte slice. The length of the slice is at least n bytes.
(bigint *big.Int, n int)
| 136 | // PaddedBigBytes encodes a big integer as a big-endian byte slice. The length |
| 137 | // of the slice is at least n bytes. |
| 138 | func PaddedBigBytes(bigint *big.Int, n int) []byte { |
| 139 | if bigint.BitLen()/8 >= n { |
| 140 | return bigint.Bytes() |
| 141 | } |
| 142 | ret := make([]byte, n) |
| 143 | ReadBits(bigint, ret) |
| 144 | return ret |
| 145 | } |
| 146 | |
| 147 | // bigEndianByteAt returns the byte at position n, |
| 148 | // in Big-Endian encoding |