In Development Package, API may change between versions.

import "github.com/egdaemon/eg/runtime/x/wasi/egsha256x"

func Digest

func Digest[T string | []byte](b T) hash.Hash

digest the provided contents and return the resulting hash. if an error occurs during hashing then a nil value is returned.

func DigestFile

func DigestFile(path ...string) hash.Hash

digest the contents from the provided filename and return the resulting hash. if an error occurs during hashing then a nil value is returned.

func DigestIO

func DigestIO(r io.Reader) hash.Hash

digest the provided reader and return the resulting hash. if an error occurs during hashing then a nil value is returned.

func FormatBase64

func FormatBase64(m hash.Hash) string

format hash to a base64 encoded string

func FormatHex

func FormatHex(m hash.Hash) string

format hash to a hex encoded string

func String

func String(s string) string

String to hash base64 encoded string