sec

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const AlphaNumeric = alpha + numeric
View Source
const AlphaNumericSymbol = alpha + numeric + symbol
View Source
const DefaultCodeset = alpha + numeric + symbol
View Source
const DefaultDivisor = 4
View Source
const EncloseEscape = "\"'()<>[]`{}\\"
View Source
const OracleCodeset = alpha + numeric + oracleSymbol

Variables

This section is empty.

Functions

func B2s

func B2s(b []byte) string

func Base64

func Base64(b []byte) string

func Debase64

func Debase64(s string) ([]byte, error)

func Decrypt

func Decrypt(secret, data []byte, iteration int) ([]byte, error)

func Encrypt

func Encrypt(secret, data []byte, iteration int) ([]byte, error)

func FNV

func FNV(b []byte, n uint32) uint32

func HMAC

func HMAC(key, data []byte) []byte

func HMACFNV

func HMACFNV(x, y []byte, max uint32) uint32

func InitSPIKey

func InitSPIKey() ([]byte, error)

InitSPIKey return a random initial key

func KDF

func KDF(secret []byte, keyCount, keyLen int) ([][]byte, error)

func KeyGen

func KeyGen(codebook string, x, y []byte, keyLen, iteration int) func(string, string, string, int) ([]string, error)

func MakeCodebook

func MakeCodebook(codeset, mask string) string

func Power2

func Power2(n int64) int64

Power2 returns the max exponent x where 2^x < n!

func RandomBytes

func RandomBytes(size int) ([]byte, error)

func S2b

func S2b(s string) []byte

func SPA

func SPA(secret, salt []byte, keyLen, iteration int) ([]byte, error)

func SPAKDF

func SPAKDF(raw, salt []byte, keyCount, keyLen, iteration int) ([][]byte, error)

func SPIHash

func SPIHash(secret, key []byte) []byte

func SPIKey

func SPIKey(secret, key, newSecret []byte) []byte

SPIKey returns a new key for the new secret given the old secret and key, the new secret and key will hash to the same value with hmac/fnv. The old key is divided into chunks of 3 bytes and used for the computation of the new key based on hmac/fnv hash.

func SpaceOut

func SpaceOut(s string, divisor int) string

SpaceOut inserts spaces.

Types

This section is empty.

Jump to

Keyboard shortcuts

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