Wisent: a Python parser generator. A Python LR(1) parser generator. … read more

The Fortuna Random Number Generator. An implementation of the Fortuna random number generator by N. Ferguson and B. Schneier in Go. … read more

Blog: The Fortuna Random Number Generator. A new implementation of the Fortuna Random Number Generator in Go. … read more

The SHA-256d Hash for Go

By Jochen Voss, last updated 2013-07-16

The sha256d package provides an implementation of the SHA-256d hash algorithm (also known as "double SHA-256") for the Go programming language. SHA-256d is a cryptographic hash, first proposed by Ferguson and Schneier in the book "Practical Cryptography". The SHA-256d hash is used in the Bitcoin protocol and in the Fortuna random number generator.

The SHA-256d hash is obtained by applying the SHA-256 hash twice, i.e. by first applying SHA-256 to the data and then again to the resulting hash.


To download the sha256d package, simply use the go get command as follows:

  go get github.com/seehuhn/sha256d

The source code is available at github.com/seehuhn/sha256d.


The sha256d package implements the standard hash.Hash interface. Example:

  hash := sha256d.New()
  n, _ := hash.Write([]byte("hello"))
  hashVal := hash.Sum(nil)

Copyright © 2013, Jochen Voss. All content on this website (including text, pictures, and any other original works), unless otherwise noted, is licensed under a Creative Commons Attribution-Share Alike 3.0 License.