algo

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package algo implement common api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSlashes

func AddSlashes(s string) string

AddSlashes returns a string with backslashes added before characters that need to be escaped.

func Hash

func Hash(method Method, s string) string

Hash Generate a hex hash value, expects: MD5, SHA1, SHA224, SHA256, SHA384, SHA512.

func Hmac

func Hmac(method Method, s, key string) string

Hmac Generate a hex hash value with the key, expects: MD5, SHA1, SHA224, SHA256, SHA384, SHA512.

func MD5

func MD5(s string) string

MD5 calculate the md5 hash of a hex string.

func QuoteMeta

func QuoteMeta(s string) string

QuoteMeta returns a version of str with a backslash character (\) before every character that is among these: . \ + * ? [ ^ ] ( $ )

func SHA1

func SHA1(s string) string

SHA1 calculate the sha1 hash of a hex string.

func StripSlashes

func StripSlashes(s string) string

StripSlashes returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).

Types

type Method

type Method string

Method algo method

const (
	MethodMD5    Method = "md5"
	MethodSha1   Method = "sha1"
	MethodSha224 Method = "sha224"
	MethodSha256 Method = "sha256"
	MethodSha384 Method = "sha384"
	MethodSha512 Method = "sha512"
)

algo method

Jump to

Keyboard shortcuts

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