Golang:将字节数组转换为big.Int-_varint转换问题

时间:2021年05月07日 21:13:46

I'm trying to create an RSA Public Key from a Modulus and Exponent stored in a byte array.After some experimentation I've got the following:

func bytes_to_int(b []byte) (acc uint64) {length := len(b)if length % 4 != 0 {extra := (4 - length % 4)b = append([]byte(strings.Repeat("\000", extra)), b...)length += extra}var block uint32for i := 0; i < length; i += 4 {block = binary.BigEndian.Uint32(b[i:i+4])acc = (acc

序列化

https://puppylpg.github.io/2020/05/15/serialization-protobuf

RPC漫谈

https://blog.joway.io/posts/deep-into-rpc-serialization

Golang

https://ask.csdn.net/questions/1048364