aes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT, Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptN = 1 << 18

	// StandardScryptP is the P parameter of Scrypt encryption algorithm, using 256MB
	// memory and taking approximately 1s CPU time on a modern processor.
	StandardScryptP = 1
)

Variables

View Source
var (
	ErrDecrypt = errors.New("could not decrypt key with given password")
)

Functions

func Decrypt

func Decrypt(cryptoJson *CryptoJSON, pwd []byte) ([]byte, error)

func Keccak256

func Keccak256(data ...[]byte) []byte

nolint

Types

type CryptoJSON

type CryptoJSON struct {
	Cipher       string                 `json:"cipher"`
	CipherText   string                 `json:"ciphertext"`
	CipherParams cipherparamsJSON       `json:"cipherparams"`
	KDF          string                 `json:"kdf"`
	KDFParams    map[string]interface{} `json:"kdfparams"`
	MAC          string                 `json:"mac"`
}

func EncryptData

func EncryptData(password, data []byte, scryptN, scryptP int) (*CryptoJSON, error)

type EncryptedKey

type EncryptedKey struct {
	Address string       `json:"address"`
	KeyType core.KeyType `json:"type"`
	Crypto  *CryptoJSON  `json:"crypto"`
}

type KeccakState

type KeccakState interface {
	hash.Hash
	Read([]byte) (int, error)
}

func NewKeccakState

func NewKeccakState() KeccakState

NewKeccakState creates a new KeccakState

Jump to

Keyboard shortcuts

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