git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/crypto/chacha/hchacha20_noasm.go (about) 1 //go:build (!amd64 && !386) || !gc || purego 2 3 package chacha 4 5 func hChaCha20(out, key, nonce []byte) ([]byte, error) { 6 if len(key) != HChaCha20KeySize { 7 return nil, ErrBadHChaCha20KeySize 8 } 9 if len(nonce) != HChaCha20NonceSize { 10 return nil, ErrBadHChaCha20NonceSize 11 } 12 13 hChaCha20Generic((*[32]byte)(out), (*[16]byte)(nonce), (*[32]byte)(key)) 14 return out, nil 15 }