Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

lukechampine.com/ascon

Package Overview
Dependencies
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lukechampine.com/ascon

Go Modules
Version
v1.0.0
Version published
Created
Source

ascon

GoDoc Go Report Card

go get lukechampine.com/ascon

This repo contains a pure-Go implementation of ASCON-128, a lightweight authenticated encryption algorithm. (ASCON is a family of algorithms, but currently this repo only implements ASCON-128.)

Usage

ascon.AEAD implements the cipher.AEAD interface, so usage should be familiar:

import "lukechampine.com/ascon"

func main() {
    key := make([]byte, ascon.KeySize) // in practice, read this from crypto/rand
    aead, _ := ascon.New(key)
    nonce := make([]byte, ascon.NonceSize)
    plaintext := []byte("Hello, world!")
    ciphertext := aead.Seal(nil, nonce, plaintext, nil)
    recovered, _ := aead.Open(nil, nonce, ciphertext, nil)
    println(string(recovered)) // Hello, world!
}

Benchmarks

The pure Go code is pretty underwhelming; expect 100-200 MB/s. Maybe I'll add an asm implementation someday.

FAQs

Package last updated on 24 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts