Documentation ¶
Overview ¶
Package crypto implements basic crypto primitives used in the project
Index ¶
Constants ¶
View Source
const (
KeyLength = 32
)
Variables ¶
This section is empty.
Functions ¶
func Float64 ¶ added in v0.6.2
func Float64() float64
Float64 is a shortcut for generating a random float between 0 and 1 using crypto/rand.
func GetRandomString ¶ added in v0.6.0
GetRandomString generates a random string for cryptographic usage.
func GetRandomValueFromInterval ¶ added in v0.6.2
func GetRandomValueFromInterval[V ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | float32 | float64](randomizationFactor float64, currentInterval V) V
Returns a random value from the following interval:
[currentInterval - randomizationFactor * currentInterval, currentInterval + randomizationFactor * currentInterval].
Types ¶
type Key ¶
func GenerateKey ¶
func GenerateKeyFromPassword ¶
func GeneratePrivateKey ¶
func ParseKeyBytes ¶
func (Key) MarshalText ¶
func (*Key) UnmarshalText ¶
type KeyPassphrase ¶
type KeyPassphrase Key
A key which uses GenerateKeyFromPassword() for UnmarshalText().
func (*KeyPassphrase) UnmarshalText ¶
func (k *KeyPassphrase) UnmarshalText(text []byte) error
type PublicKeyPair ¶
type PublicKeyPair KeyPair
Click to show internal directories.
Click to hide internal directories.