utils

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(hash, password string) error

CheckPasswordHash securely compares a bcrypt hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.

func DetectMarkdownCodeBlockLanguages

func DetectMarkdownCodeBlockLanguages(markdown string) (codeblocks []string)

DetectMarkdownCodeBlockLanguages detects and returns programming languages used in code blocks

func Hash

func Hash(tag string, data string) string

Hash generates a hash of data using HMAC-SHA-512/256. The tag is intended to be a natural-language string describing the purpose of the hash, such as "hash file for lookup key" or "master secret to client secret". It serves as an HMAC "key" and ensures that different purposes will have different hash output. This function is NOT suitable for hashing passwords.

func HashPassword

func HashPassword(password string) (string, error)

HashPassword generates a bcrypt hash of the password using work factor 10.

func RenderMarkdownToHTML

func RenderMarkdownToHTML(markdown string) template.HTML

func UUID

func UUID() string

func ZipFiles added in v1.5.0

func ZipFiles(filename string, files []string) error

ZipFiles will zip files to filename

Types

This section is empty.

Jump to

Keyboard shortcuts

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