solsha3

package module
v0.0.0-...-c0c57c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2019 License: MIT Imports: 8 Imported by: 1

README

go-solidity-sha3

Generate Solidity SHA3 (Keccak256) hashes in Go.

License Go Report Card GoDoc

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

Install

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

Documentation

Documentation on GoDoc

Usage

Simple example

package main

import (
  "encoding/hex"
  "fmt"
  "github.com/BeamNetwork/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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(input interface{}) []byte

Address address

func Bool

func Bool(input interface{}) []byte

Bool bool

func Bytes16

func Bytes16(input interface{}) []byte

Bytes16 bytes16

func Bytes32

func Bytes32(input interface{}) []byte

Bytes32 bytes32

func ConcatByteSlices

func ConcatByteSlices(arrays ...[]byte) []byte

ConcatByteSlices concat byte slices

func Int128

func Int128(input interface{}) []byte

Int128 int128

func Int16

func Int16(input interface{}) []byte

Int16 int16

func Int256

func Int256(input interface{}) []byte

Int256 int256

func Int32

func Int32(input interface{}) []byte

Int32 int32

func Int64

func Int64(input interface{}) []byte

Int64 int64

func Int8

func Int8(input interface{}) []byte

Int8 int8

func SoliditySHA3

func SoliditySHA3(data ...[]byte) []byte

SoliditySHA3 solidity sha3

func SoliditySHA3WithPrefix

func SoliditySHA3WithPrefix(data []byte) []byte

SoliditySHA3WithPrefix solidity sha3 with prefix

func String

func String(input interface{}) []byte

String string

func Uint128

func Uint128(input interface{}) []byte

Uint128 uint128

func Uint16

func Uint16(input interface{}) []byte

Uint16 uint16

func Uint256

func Uint256(input interface{}) []byte

Uint256 uint256

func Uint32

func Uint32(input interface{}) []byte

Uint32 uint32

func Uint64

func Uint64(input interface{}) []byte

Uint64 uint64

func Uint8

func Uint8(input interface{}) []byte

Uint8 uint8

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL