https://github.com/aegis-aead/go-libaegis
The AEGIS family of authenticated encryption algorithms for Go.
https://github.com/aegis-aead/go-libaegis
aead aegis cipher encryption golang
Last synced: about 1 year ago
JSON representation
The AEGIS family of authenticated encryption algorithms for Go.
- Host: GitHub
- URL: https://github.com/aegis-aead/go-libaegis
- Owner: aegis-aead
- License: mit
- Created: 2025-02-24T22:20:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-12T00:23:13.000Z (about 1 year ago)
- Last Synced: 2025-04-14T02:06:31.166Z (about 1 year ago)
- Topics: aead, aegis, cipher, encryption, golang
- Language: C
- Homepage:
- Size: 500 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-libaegis
[](https://pkg.go.dev/github.com/aegis-aead/go-libaegis)
[](https://github.com/aegis-aead/go-libaegis/blob/main/LICENSE)
A Go binding for [libaegis](https://github.com/aegis-aead/libaegis), implementing [the AEGIS family](https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/) of modern authenticated encryption algorithms designed for high performance and security.
## Features
- Provides a Go wrapper around `libaegis` for seamless integration.
- Implements AEGIS-128L, AEGIS-128X, AEGIS-256 and AEGIS-256X.
- Optimized for modern CPUs with hardware acceleration.
- Lightweight and easy to use within Go applications.
## Installation
To install `go-libaegis`, use:
```sh
go get github.com/aegis-aead/go-libaegis
```
## Usage
```go
package main
import (
"crypto/rand"
"fmt"
// other options:
// aegis128l, aegis128x4, aegis256, aegis256x2, aegis256x4
"github.com/aegis-aead/go-libaegis/aegis128x2"
)
func main() {
key := make([]byte, aegis128x2.KeySize)
rand.Read(key)
nonce := make([]byte, aegis128x2.NonceSize)
rand.Read(nonce)
plaintext := []byte("Hello, world!")
associatedData := []byte("metadata")
// tag size can be 16 or 32 bytes
aead, err := aegis128x2.New(key, 16)
if err != nil {
panic(err)
}
ciphertext := aead.Seal(nil, nonce, plaintext, associatedData)
decrypted, err := aead.Open(nil, nonce, ciphertext, associatedData)
if err != nil {
panic(err)
}
fmt.Println("Decrypted message:", string(decrypted))
}
```
## Requirements
- Go 1.19+
- A C toolchain
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
## Security Notice
Always ensure that you use randomly generated keys and unique nonces when using authenticated encryption to maintain security.
### Alternatives in Go
- [`github.com/ericlagergren/aegis`](https://github.com/ericlagergren/aegis) implements AEGIS-128L and AEGIS-256 without the need for CGO.