Coder Social home page Coder Social logo

gokangarootwelve's Introduction

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:

gokangarootwelve's People

Contributors

mimoo avatar scratch-net avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gokangarootwelve's Issues

Switch state after first read

	hash := K12.NewK12(nil)
	buf := make([]byte, 32)
	hash.Write(buf)
	hash.Read(buf)
	hash.Read(buf)

causes panic because sponge thinks we are still spongeAbsorbing

Applying K12's "vine" construction to other sponges

Is it possible to generalize KangarooTwelve to the Vine construction ("leaves staple to a pole") for SHA3 competition round 2 candidates (reduced Fugue, Hamsi and Luffa)? And JH and CubeHash are not necessary since they are proven to be too insecure.
note: BLAKE has been modified into NORX, and Skein is a semi-sponge so there are potential as well.

Not an issue but more of a general question

In the example of K12Sum...

Is there a way we can do a K12-256/512 and whatever flavors of the world?

If so, I can probably write that and push you the information.
just wanted to know if hash.Read(out) being []byte, 32 was the 256 edition...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.