hashing

package module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 0 Imported by: 2

README

hashing

Installation

go get github.com/go-fires/hashing

Usage

package main

import (
	"github.com/go-fires/hashing/bcrypt"
	"github.com/go-fires/hashing/md5"
	"github.com/go-fires/hashing/sha1"
)

func main() {
	md5.New().Make("hello")
	md5.New().MustMake("hello")
	md5.New().Check("hello", "68656c6c6fda39a3ee5e6b4b0d3255bfef95601890afd80709")

	bcrypt.New().Make("hello")
	bcrypt.New().MustMake("hello")
	bcrypt.New().Check("hello", "68656c6c6fda39a3ee5e6b4b0d3255bfef95601890afd80709")

	sha1.New().Make("hello")
	sha1.New().MustMake("hello")
	sha1.New().Check("hello", "68656c6c6fda39a3ee5e6b4b0d3255bfef95601890afd80709")
}

License

The MIT License (MIT). Please see License File for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher interface {
	// Make a hash value from the given value.
	Make(value string) (string, error)

	// MustMake a hash value from the given value.
	// If an error occurs, it will panic.
	MustMake(value string) string

	// Check the given value matches the given hashed value.
	// If you Make() is error, it will return false.
	Check(value, hashedValue string) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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