wallet

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Example
strEncrypted, err := DesEncrypt([]byte("hello world"), []byte("12345678"))
if err != nil {
	log.Fatal(err)
}
strDecrypted, err := DesDecrypt(strEncrypted, []byte("12345678"))
if err != nil {
	log.Fatal(err)
}
fmt.Println("Encrypted:", strEncrypted)
fmt.Println("Decrypted:", string(strDecrypted))
Output:

Encrypted: 28dba02eb5f6dd476042daebfa59687a
Decrypted: hello world

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePriKey

func DecodePriKey(b []byte) *ecdsa.PrivateKey

func DecodePubKey

func DecodePubKey(b []byte) *ecdsa.PublicKey

func DesDecrypt

func DesDecrypt(decrypted string, key []byte) ([]byte, error)

func DesEncrypt

func DesEncrypt(text, key []byte) (string, error)

func EncodePriKey

func EncodePriKey(priKey *ecdsa.PrivateKey) []byte

func EncodePubKey

func EncodePubKey(pubKey *ecdsa.PublicKey) []byte

func NewKeys

func NewKeys() (*ecdsa.PrivateKey, *ecdsa.PublicKey)

func TrimKey

func TrimKey(key []byte) []byte

func Verity

func Verity(data, sign []byte, pubKey *ecdsa.PublicKey) bool

func ZeroPadding

func ZeroPadding(ciphertext []byte, blockSize int) []byte

func ZeroUnPadding

func ZeroUnPadding(origData []byte) []byte

Types

type Wallet

type Wallet struct {
	PriKey  *ecdsa.PrivateKey
	PubKey  *ecdsa.PublicKey
	Address common.Address
}

func LoadWallet

func LoadWallet(filename string, pass []byte, acc string) *Wallet

func NewWallet

func NewWallet() *Wallet

func (*Wallet) Sign

func (w *Wallet) Sign(data []byte) []byte

func (*Wallet) StoreKey

func (w *Wallet) StoreKey(filename string, pass []byte)

Jump to

Keyboard shortcuts

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