Generate Solidity SHA3 (Keccak256) hashes in Go (golang)
Clone or download
Latest commit 31f1812 Jan 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example example print Jun 22, 2018
.editorconfig editorconfig Dec 4, 2017
.gitignore init Dec 3, 2017
.travis.yml add travis Jan 19, 2019
LICENSE.md add license Jan 22, 2018
Makefile GO111MODULE=on Jan 12, 2019
README.md update readme Jan 19, 2019
go.mod update sha3 package import Jan 11, 2019
go.sum update sha3 package import Jan 11, 2019
solsha3.go update sha3 package import Jan 11, 2019
solsha3_test.go accept interfaces May 18, 2018

README.md


logo


go-solidity-sha3

Generate Solidity SHA3 (Keccak256) hashes in Go.

License Build Status Go Report Card GoDoc

This package is the Go equivalent of require('ethereumjs-abi').soliditySHA3 NPM module.

Install

go get -u github.com/miguelmota/go-solidity-sha3

Documentation

Documentation on GoDoc

Usage

Simple example

package main

import (
  "encoding/hex"
  "fmt"
  "github.com/miguelmota/go-solidity-sha3"
  "math/big"
)

func main() {
  hash := solsha3.SoliditySHA3(
    solsha3.Address("0x12459c951127e0c374ff9105dda097662a027093"),
    solsha3.Uint256(big.NewInt(100)),
    solsha3.String("foo"),
    solsha3.Bytes32("bar"),
    solsha3.Bool(true),
  )

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

Output

417a4c44724701ba79bb363151dff48909bc058a2c75a81e9cf5208ae4699369

License

MIT