Answer the question
In order to leave comments, you need to log in
[[+content_image]]
Convert type []byte to [32]byte?
The input is a variable in the []byte type, then this variable is used as a key in the dictionary|slice
map[[32]byte]string with a fixed length of 32 bytes.
If it doesn't make it difficult, please provide several options for converting.
Answer the question
In order to leave comments, you need to log in
https://stackoverflow.com/questions/30285680/how-t...copy(dst_array[:], src_slice)
Can be converted using "black magic" unsafe , but be careful
func b2arr32(b []byte) [32]byte {
return *(*[32]byte)(unsafe.Pointer(&b))
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question