algorithm

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package algorithm contains cryptographic helpers used by GooseForum.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncryptPassword

func EncryptPassword(password string) (string, string, error)

EncryptPassword hashes password with a random salt.

func GenerateRandomBytes added in v0.0.2

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns n cryptographically secure random bytes.

func GenerateSigningKey added in v0.0.2

func GenerateSigningKey(keyLength int) (string, error)

GenerateSigningKey returns a URL-safe base64 signing key with no padding.

func MakePassword

func MakePassword(password string) (string, error)

MakePassword hashes password and returns a storable hash:salt string.

func SafeGenerateSigningKey added in v0.0.2

func SafeGenerateSigningKey(keyLength int) string

SafeGenerateSigningKey returns a URL-safe signing key, falling back to best-effort entropy.

func VerifyEncryptPassword

func VerifyEncryptPassword(secretPassword, inputPassword string) error

VerifyEncryptPassword verifies inputPassword against a stored hash:salt value.

func VerifyPassword

func VerifyPassword(encodedHash, encodedSalt, inputPassword string) error

VerifyPassword verifies inputPassword against encodedHash and encodedSalt.

Types

This section is empty.

Jump to

Keyboard shortcuts

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