zstdzgo.at/zstd/zcrypto Index | Files

package zcrypto

import "zgo.at/zstd/zcrypto"

Package zcrypto implements cryptographic helpers.

Index

Functions

func Hash

func Hash(h hash.Hash, value string) string

Hash returns the base-16 encoded string of value hashed with h.

func HashFile

func HashFile(filename string) (string, error)

HashFile creates a SHA-256 hash for a file, as "sha256-hash".

func Secret128

func Secret128() string

Secret number of 128 bits formatted in base36 (~25 bytes).

func Secret192

func Secret192() string

Secret number of 192 bits formatted in base36 (~38 bytes).

func Secret256

func Secret256() string

Secret number of 256 bits formatted in base36 (~48 bytes).

func Secret64

func Secret64() string

Secret number of 64 bits formatted in base36 (~12 bytes).

func SecretString

func SecretString(size int, sel string) string

Secret string of size characters selected from sel.

If sel is "" it will use [0-9a-zA-Z], excluding some easily confused characters: 0, 1, i, l, o, I, and O.

func VerifyHash

func VerifyHash(filename, hash string) (bool, error)

VerifyHash verifies a file with a hash from HashFile().

Source Files

zcrypto.go

Version
v0.0.0-20240930202209-a63c3335042a (latest)
Published
Sep 30, 2024
Platform
linux/amd64
Imports
12 packages
Last checked
2 days ago

Tools for package owners.