util

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ID_LEN = 16

Variables

This section is empty.

Functions

func FastXor

func FastXor(dst, a, b []byte)

Xor 16 bytes the fastest way

From https://github.com/lukechampine/fastxor Stores (a xor b) in dst, where a, b, and dst all have length 16.

func GetConn

func GetConn(network, address, certFile, keyFile string) (net.Conn, error)

Get a connection with/without TLS

TODO: remove InsecureSkipVerify from tls.Config

func GetListener

func GetListener(network, address, certFile, keyFile string) (net.Listener, error)

func GetName

func GetName(id []byte) string

Returns base64url encoding of id

Used for block filename

func GetNumber

func GetNumber(id []byte) uint64

Returns big endian uint64 of id

func HashStr

func HashStr(val string) []byte

Uses Go's built-in fast hash func FNV version 128a

func RandomId

func RandomId() ([]byte, error)

func SlowXor

func SlowXor(dst, a, b []byte)

For benchmark comparison

Types

This section is empty.

Jump to

Keyboard shortcuts

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