tools

package
v0.0.0-...-298ae05 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

// 请不要直接使用这个包,请把你要使用的函数copy到项目的utils里面。

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadLocationFromTZData func(name string, data []byte) (*time.Location, error) = nil
View Source
var TZData []byte = nil

Functions

func Abs

func Abs(a int64) int64

绝对值

func Abs2

func Abs2(n int64) int64

绝对值

func CompareHashAndPassword

func CompareHashAndPassword(cipher, pwd []byte) error

将密文与密码比较。error==nil 则相等。

func GenerateFromPassword

func GenerateFromPassword(pwd []byte) ([]byte, error)

用密码生产一个密文

func GetGMTLocation

func GetGMTLocation() (*time.Location, error)

func GetRootDir

func GetRootDir() (p string)

获取运行的根目录

func GetTimeInFormatISO8601

func GetTimeInFormatISO8601() (timeStr string)

func GetTimeInFormatRFC2616

func GetTimeInFormatRFC2616() (timeStr string)

func Md5Hash

func Md5Hash(byt []byte) string

BenchmarkMd5Hash-4 3500572 326 ns/op BenchmarkSha1Hash-4 2593280 423 ns/op BenchmarkMurmurHash32-4 80041621 14.6 ns/op BenchmarkMurmurHash64-4 37517820 35.3 ns/op murmurhash相比其它的算法有三倍以上的性能提升

func Md5Hex

func Md5Hex(byt []byte, salt []byte) string

func Murmur128

func Murmur128(byt []byte) (uint64, uint64)

func Murmur32

func Murmur32(byt []byte) uint32

func Murmur64

func Murmur64(byt []byte) uint64

func RandString

func RandString(n int) string

func RandStringRunes

func RandStringRunes(n int) string

func RunTime

func RunTime(now, start int64) string

运行时间

func Scrypt

func Scrypt(pwd []byte, salt []byte) ([]byte, error)

可以获取唯一的相应的密码值,这是目前为止最难破解的,但耗时比较久100ms

func Sha1Hash

func Sha1Hash(byt []byte) string

func Sha256Hex

func Sha256Hex(byt []byte, salt []byte) string

func Sha512Hex

func Sha512Hex(byt []byte, salt []byte) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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