util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: GPL-3.0 Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// All represents the string instruction set that contains all alpha-numeric characters.
	All set = [2]int{0, 62}
	// Upper represents the string instruction set that contains only uppercase non-numeric characters.
	Upper set = [2]int{26, 52}
	// Lower represents the string instruction set that contains only lowercase non-numeric characters.
	Lower set = [2]int{0, 26}
	// Numbers represents the string instruction set that contains only numeric characters.
	Numbers set = [2]int{52, 62}
	// Characters represents the string instruction set that contains mixed case non-numeric characters.
	Characters set = [2]int{0, 52}
)
View Source
var Rand = &random{Rand: rand.New(rand.NewSource(cputicks()))}

Rand is the custom Random number generator, based on the current time as a seed.

Functions

func Decode

func Decode(k, d []byte) string

Decode is used to un-encode a string written in a XOR byte array "encrypted" by the specified key. This function returns the string value of the result but also modifies the input array, which can be used to re-use the resulting string.

func FastRand

func FastRand() uint32

FastRand is a fast thread local random function. This should be used in place instead of 'Rand.Uint32()'.

Taken from https://github.com/dgraph-io/ristretto/blob/master/z/rtutil.go Thanks!

func FastRandN

func FastRandN(n int) uint32

FastRandN is a fast thread local random function. This should be used in place instead of 'Rand.Uint32n()'. This function will take a max value to specify.

func FastUTF8Match

func FastUTF8Match(s, m string) bool

FastUTF8Match is a function that will return true if both of the strings match regardless of case (case insensitive). This function ONLY works properly on UTF8 characters as the tradeoff for fastness.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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