tryte_cipher

package
v0.0.0-...-cb976ff Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAESCryptor

func CreateAESCryptor(passphrase string, option ScryptOptions) (aesChacha2AEAD cipher.AEAD, err error)

initialise Cipher with passphrase and options set in ScryptOptions struct

func Decrypt

func Decrypt(encryptedSeed trinary.Trytes, passphrase string, options ScryptOptions) (tryteDecryptedSeed trinary.Trytes, err error)

Decrypt an Encrypted Tryte Seed

func Encrypt

func Encrypt(seed trinary.Trytes, passphrase string, options ScryptOptions, toughnessInput int) (result string, err error)

Encrypt tryte string using AES the passphrase comes from scrypt, based on the SHA256 hash of the passphrase. takes seed Tryte, passphrase of any string, optional ScryptOptions struct Alternatively toughnessInput will calculate the required settings for AES

func FindPowerOfNToughness

func FindPowerOfNToughness(n int) (bits int, err error)

Calculate the number of bits based on user input that is greater than 0

func GenerateRandomBytes

func GenerateRandomBytes(n int) (b []byte, err error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomSeed

func GenerateRandomSeed() (seed string, err error)

GenerateRandomSeed returns a securely generated string. It will return an error if a secure random int generator fails to function correctly

func RandomPassphraseGenerator

func RandomPassphraseGenerator(n int) (stringBytes string, err error)

func ToughnessSetting

func ToughnessSetting(n int) (toughness string, err error)

Determine if the toughness level should be printed in the encrypted seed

Types

type ScryptOptions

type ScryptOptions struct {
	N      int
	R      int
	P      int
	KeyLen int
}

type TryteEncryptor

type TryteEncryptor interface{}

Jump to

Keyboard shortcuts

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