ascon

package module
v0.0.0-...-10d5be4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2019 License: MIT Imports: 5 Imported by: 0

README

ansemjo/ascon

This is a Go binding for the Ascon-128 cipher, which is the preferred cipher for use in lightweight applications from the CAESAR portfolio.

It implements the cipher.AEAD interface:

package main

import (
  // "..."
  "github.com/ansemjo/ascon"
)

func main() {

  // [...]

  // initialize with 16 byte key
  aead, err := ascon.New(key)
  if err != nil {
    panic("failed aead init")
  }

  // seal plaintext
  ct := aead.Seal(nil, nonce, plaintext, associated)

  // open ciphertext
  pt, err := a.Open(nil, nonce, ct, associated)
  if err != nil {
    panic(err.Error())
  }

  // [...]

}

Currently binds to the optimized 64 bit implementation of ascon128v12 from ascon/crypto_aead.

DISCLAIMER

I am not a professional cryptographer. This is simply a binding to toy around with an interesting new cipher and should be tested and audited thoroughly before use. Especially because I am using lots of unsafe.Pointer()'s here.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Documentation

Overview

Package ascon binds to the C reference implementation of Ascon-128 v1.2 from the final CAESAR portfolio and implements the cipher.AEAD interface. https://ascon.iaik.tugraz.at/specification.html

Index

Constants

View Source
const (
	KeySize   = 16
	NonceSize = 16
	Overhead  = 16
)

Expected key, nonce and authentication tag overhead lengths

Variables

This section is empty.

Functions

func New

func New(key []byte) (cipher.AEAD, error)

New returns a new Ascon-128 AEAD that uses the given 128-bit key.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL