Registry / crypto / aead-chacha20poly1305

aead-chacha20poly1305

JSON →
library0.0.0-20201124145622-1a5aba2a8b29gogounverified

Package chacha20poly1305 implements the ChaCha20-Poly1305 AEAD cipher.

go get github.com/aead/chacha20poly1305
INSTALL
IMPORT
SIG · AEAD-CHACHA20POLY1
A
aead-chacha20poly1305
cryptogov0.0.0-20201124145622-1a5aba2a8b29
harness data pending
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) }
Debug
Known issues
gotchaThis package is a low-level cryptographic implementation; ensure correct nonce handling.
fix
Always use a unique nonce for each encryption with the same key.
affects: all
Upgrade
Version history
0.0.0-20201124145622-1a5aba2a8b29latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
56 hits · last 30 days
node
50
Resources
aead-chacha20poly1305 — go get aead-chacha20poly1305 · libregistry