Documentation

Index

Constants

View Source
const HashSize = 32

    HashSize is the size of a hash

    Variables

    View Source
    var EmptyHash [HashSize]byte

      EmptyHash is the hash value for empty byte array

      Functions

      func HashData

      func HashData(hasher Keccak, data []byte) (ha []byte, er error)

        HashData hashes the given data and returns its sha3 hash value

        func HashFile

        func HashFile(hasher Keccak, fp string) (ha []byte, er error)

          HashFile hashes the given file and returns its sha3 hash value

          func HashStream

          func HashStream(hasher Keccak, reader io.Reader) (ha []byte, er error)

            HashStream hashes the given stream and returns its sha3 hash value

            func VerifyHash

            func VerifyHash(hash []byte) error

              VerifyHash verifies the hash value. At the moment, it only verifies the hash size

              Types

              type Keccak

              type Keccak interface {
              	hash.Hash
              	Read([]byte) (int, error)
              }

                Keccak wraps sha3.state. In addition to the usual hash methods, it also supports Read to get a variable amount of data from the hash state. Read is faster than Sum because it doesn't copy the internal state, but also modifies the internal state.

                func NewKeccak

                func NewKeccak() Keccak

                  NewKeccak creates a new SHA3 Keccak hasher

                  Source Files