whirlpool cryptographic hashing library

whirlpool.go

A whirlpool hashing library for go

Build status

Build Status

Setup

$ go get github.com/jzelinskie/whirlpool

Example

package main

import (
  "fmt"
  "github.com/jzelinskie/whirlpool"
)

func main() {
  w := whirlpool.New()
  text := []byte("This is an example.")
  w.Write(text)
  fmt.Println(w.Sum(nil))
}

Docs

Check out the gopkgdoc page, but there isn't much -- it works just like the other hashes in the standard library

Branches

  • master - stable, works like the hash libs in the corelib
  • trace - same code as master, but prints midstate values to stdout

license

Modified BSD License

Similar Resources

This library generate a new tlsconfig usable within go standard library configured with a self-signed certificate generated on the fly

sslcert This library generate a new tlsconfig usable within go standard library configured with a self-signed certificate generated on the fly. Exampl

Dec 17, 2022

This library aims to make it easier to interact with Ethereum through de Go programming language by adding a layer of abstraction through a new client on top of the go-ethereum library.

Simple ethereum client Simple ethereum client aims to make it easier for the developers to interact with Ethereum through a new layer of abstraction t

May 1, 2022

Port of Google's Keyczar cryptography library to Go

Important note: Keyczar is deprecated. The Keyczar developers recommend Tink. This is a port of Google's Keyczar library to Go. Copyright (c) 2011 Dam

Nov 28, 2022

Golang Library for automatic LetsEncrypt SSL Certificates

Obtains certificates automatically, and manages renewal and hot reload for your Golang application. It uses the LEGO Library to perform ACME challenges, and the mkcert utility to generate self-signed trusted certificates for local development.

Dec 23, 2022

Pure Go Kerberos library for clients and services

gokrb5 It is recommended to use the latest version: Development will be focused on the latest major version. New features will only be targeted at thi

Dec 13, 2022

:key: Idiotproof golang password validation library inspired by Python's passlib

passlib for go 100% modules-free. Python's passlib is quite an amazing library. I'm not sure there's a password library in existence with more thought

Dec 19, 2022

A convenience library for generating, comparing and inspecting password hashes using the scrypt KDF in Go 🔑

simple-scrypt simple-scrypt provides a convenience wrapper around Go's existing scrypt package that makes it easier to securely derive strong keys ("h

Dec 22, 2022

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

Jan 7, 2023

Easy to use encryption library for Go

encryptedbox EncryptedBox is an easy to use module for Go that can encrypt or sign any type of data. It is especially useful when you must serialize y

Jul 20, 2022
Comments
  • PR_AddingPowerSupport_golang-github-jzelinskie-whirlpool

    PR_AddingPowerSupport_golang-github-jzelinskie-whirlpool

    Adding Power Support.

    Adding Power support & making the build run for both arch: amd64/ppc64le.

    Adding power support ppc64le This is part of the Ubuntu distribution for ppc64le. This helps us simplify testing later when distributions are re-building and re-releasing. For more info tag @gerrith3.

  • Very slow

    Very slow

    This realization of Whirlpool works very slow. For example, i wrote a program, which hashing all files in current directory and printing result. I used 2 variants of builds and compared them to PHP realization of same program. Enviroment: Intel Core2 Duo CPU E7500 @ 2.93GHz 3536 Mb DDR2 Ubuntu 12.04 with last updates

    ➜ uname -a
    Linux pyxis-server 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 2013 i686 i686 i386 GNU/Linux
    ➜ go version
    go version go1
    ➜ go env
    GOROOT="/usr/lib/go"
    GOBIN=""
    GOARCH="386"
    GOCHAR="8"
    GOOS="linux"
    GOEXE=""
    GOHOSTARCH="386"
    GOHOSTOS="linux"
    GOTOOLDIR="/usr/lib/go/pkg/tool/linux_386"
    GOGCCFLAGS="-g -O2 -fPIC -m32 -pthread"
    CGO_ENABLED="1"
    ➜ aptitude show golang
    ...
    Version: 2:1-5
    ...
    ➜ php -v
    PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch (cli) (built: Apr  4 2014 01:27:23) 
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    

    The code:

    package main
    
    import (
      "fmt"
      "github.com/jzelinskie/whirlpool"
      "io/ioutil"
      "os"
      "encoding/hex"
    )
    
    func main() {
            dir, _ := os.Open("./") // current dir
            list, _ := dir.Readdirnames(-1) // if ok err == nil
            listsize := len(list)
            var hashes = make([]string, listsize)
            whi := whirlpool.New()
    // bulding list of hashes
            fmt.Println("listsize =", listsize)
            for cn := 0; cn < listsize; cn++ {
                    file, _ := ioutil.ReadFile(list[cn])
                    whi.Write(file)
                    hashes[cn] = hex.EncodeToString(whi.Sum(nil))
                    fmt.Print(list[cn], " ", hashes[cn], "\n")
                    Reset()
            }
    }
    

    Almost same for PHP:

    <?php
    if ($handle = opendir('.')) {
        while (false !== ($file = readdir($handle)))
        {
            if (($file != ".") 
             && ($file != ".."))
            {
                echo $file . " " . hash( "whirlpool", file_get_contents($file) ) . "\n";
            }
        }
    
        closedir($handle);
    }
    ?>
    
    

    Results:

    # Standart compiler
    ➜ go build ./dedup.go
    ➜ time ./dedup > /dev/null
    
    real    0m4.612s
    user    0m4.588s
    sys 0m0.020s
    
    # gccgo compiler
    ➜ go build -compiler gccgo ./dedup.go
    ➜ time ./dedup > /dev/null
    
    real    0m2.110s
    user    0m2.084s
    sys 0m0.024s
    
    # PHP realization
    ➜ time php hash.php > /dev/null
    
    real    0m0.634s
    user    0m0.608s
    sys 0m0.024s
    

    I've profiled the "go build" variant of program (same run time with profiling code) and saw, that 94.1% of time program was in github.com/jzelinskie/whirlpool.(*whirlpool).transform I understand, what Go realisation may be slower (PHP have it in module written is C, i suppose), but why the difference is so huge? Is there any way to make it faster?

Go implementation of BLAKE2 (b) cryptographic hash function (optimized for 64-bit platforms).

Go implementation of BLAKE2b collision-resistant cryptographic hash function created by Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, an

Jul 11, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Jan 9, 2023
Cryptographic Addition Chain Generation in Go

Cryptographic Addition Chain Generation in Go addchain generates short addition chains for exponents of cryptographic interest with results rivaling t

Dec 5, 2022
Jan 7, 2023
goKryptor is a small and portable cryptographic tool for encrypting and decrypting files.

goKryptor goKryptor is a small and portable cryptographic tool for encrypting and decrypting files. This tool supports XOR and AES-CTR (Advanced Encry

Dec 6, 2021
An out-of-the-box cryptographic message communication.

An out-of-the-box cryptographic message communication.

Feb 8, 2022
Ekliptic - Primitives for cryptographic operations on the secp256k1 curve, with zero dependencies and excellent performance

Ekliptic This package provides primitives for cryptographic operations on the se

Sep 7, 2022
libketama-style consistent hashing in Go

===================================== ketama.go libketama-style consistent hashing in Go Author: Nolan Caudill ([email protected]) Date: 2011-06

Sep 1, 2022
Accelerate aggregated MD5 hashing performance up to 8x for AVX512 and 4x for AVX2.
Accelerate aggregated MD5 hashing performance up to 8x for AVX512 and 4x for AVX2.

Accelerate aggregated MD5 hashing performance up to 8x for AVX512 and 4x for AVX2. Useful for server applications that need to compute many MD5 sums in parallel.

Nov 23, 2022
An alternative to Consistent Hashing

Weighted Rendezvous Hashing An alternative to Consistent Hashing. Evenly distributes load on node removal. ring := rendezvous.New() for _, s := range

Feb 12, 2022