Go Assembly
Switch branches/tags
Nothing to show
Clone or download
mimoo Merge pull request #2 from Scratch-net/read_write_fix
Fix for multiple reads and writes
Latest commit f494cd8 Feb 11, 2018
Permalink
Failed to load latest commit information.
K12
README.md fix Jun 16, 2017

README.md

Kangaroo Twelve Implementation in Go

This is an implementation of KangarooTwelve in Go.

It is heavily based on the official Go's x/crypto/sha3 library. But because of minor implementation details the relevant files have been copied and modified here so you do not need Go's SHA-3 implementation to run this package. Hopefully one day Go's SHA-3 library will be more flexible to allow other keccak construction to rely on it.

I have tested this implementation with different test vectors and it works fine. Note that it has not received proper peer review. If you look at the code and find issues (or not) please let me know!

See here why you should use KangarooTwelve instead of SHA-3. But see here first why you should still not skip SHA-3.

Installation

go get github.com/mimoo/GoKangarooTwelve/K12

Usage

package main

import(
    "fmt"
    "github.com/mimoo/GoKangarooTwelve/K12"
    "encoding/hex"
)

func main(){
    // custom string allows you to customize your hash function 🙃
    customString = []byte("davidwong.fr")
    hash := K12.NewK12(customString)

	// we absorb the payload
    payload := []byte("salut!")
    hash.Write(payload)

	// we squeeze a 32 output
    out := make([]byte, 32)
    hash.Read(out)

    fmt.Println(hex.EncodeToString(out))

    // or simpler with K12Sum()
    K12Sum(customString, payload, out)

    fmt.Println(hex.EncodeToString(out))
}

Other Keccak-based things

I've implemented a few other constructions that might be helpful: