Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
chacha20poly1305
✓ github.com/aead/chacha20poly1305
Encrypts and authenticates data using ChaCha20-Poly1305.
package main
import (
"crypto/rand"
"fmt"
"github.com/aead/chacha20poly1305"
)
func main() {
key := make([]byte, chacha20poly1305.KeySize)
if _, err := rand.Read(key); err != nil {
panic(err)
}
aead, err := chacha20poly1305.New(key)
if err != nil {
panic(err)
}
nonce := make([]byte, aead.NonceSize())
ciphertext := aead.Seal(nil, nonce, []byte("hello"), nil)
fmt.Printf("Ciphertext: %x\n", ciphertext)
}
Upgrade
Version history
0.0.0-20201124145622-1a5aba2a8b29latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.