Skip to content

Authenticated encryption scheme with XChaCha20, Blake2b in the synthethic IV construction.

License

Notifications You must be signed in to change notification settings

danielhavir/xchacha20blake2b

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Godoc Reference Build Status Go Report Card

AEAD: XChaCha20-Blake2b SIV

This project implements the XChaCha20-Blake2b in the synthetic IV constructions (MAC-then-encrypt) autheticated encryption construction with extended 192-bit nonce.

Install

  • Run go get -u github.com/danielhavir/xchacha20blake2b

Example

package main

import (
    "fmt"
    "crypto/rand"

    xchacha20blake2b "github.com/danielhavir/xchacha20blake2b"
)

func main() {
    // message
    msg := ...
    // additional data
    aad := ...
    // key must be 64 bytes long
    key := ...

    // create the AEAD
    cphr, err := xchacha20blake2b.New(key)
    if err != nil {
        panic(err)
    }

    // Encrypt
    ct := cphr.Seal(nil, nil, msg, aad)

    // Decrypt
    pt, err := cphr.Open(nil, nil, ct, aad)
    if err != nil {
        panic(err)
    }

    if !bytes.Equal(msg, pt) {
        panic("plaintexts do not match")
    }
}

References

About

Authenticated encryption scheme with XChaCha20, Blake2b in the synthethic IV construction.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages