Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 650 Bytes

README.md

File metadata and controls

33 lines (26 loc) · 650 Bytes

Fiber Hashing

A hashing library built for Fiber. Supports both argon2id and bcrypt, uses argon2id by default.

Example

package main

import (
	"github.com/gofiber/fiber/v3"
	"github.com/thomasvvugt/fiber-hashing"
)

func main() {
	app := fiber.New()

	hasher := hashing.New()

	app.Get("/", func(c fiber.Ctx) error {
		hash, _ := hasher.CreateHash("ourlittlesecret")
		return c.SendString(hash)
	})

	app.Get("/match/*", func(c fiber.Ctx) error {
		match, _ := hasher.MatchHash("ourlittlesecret", c.Params("*"))
		if match {
			return c.SendString("Matches!")
		}
		return c.SendString("Does not match :c")
	})

	app.Listen(":3000")
}