crypto

package
v0.0.0-...-a8e0099 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressPubkey

func CompressPubkey(pubkey *ecdsa.PublicKey) []byte

CompressPubkey encodes a public key to the 33-byte compressed format. CompressPubkey는 공개키를 33바이트의 압축포멧으로 인코딩한다

func CreateAddress

func CreateAddress(b common.Address, nonce uint64) common.Address

CreateAddress creates an ethereum address given the bytes and the nonce CreateAddress함수는 주어진 바이트와 논스로 이더리움 주소를 생성한다

func DecompressPubkey

func DecompressPubkey(pubkey []byte) (*ecdsa.PublicKey, error)

DecompressPubkey parses a public key in the 33-byte compressed format. DecompressPubkey는 33바이트 압축형태의 공개키를 파싱한다

func Ecrecover

func Ecrecover(hash, sig []byte) ([]byte, error)

Ecrecover returns the uncompressed public key that created the given signature. Ecrecover는 주어진 서명으로부터 생성된 압축되지않은 공개키를 반환한다

func FromECDSA

func FromECDSA(priv *ecdsa.PrivateKey) []byte

FromECDSA exports a private key into a binary dump. FromECDSA는 개인키를 바이너리 덤프로 출력한다

func FromECDSAPub

func FromECDSAPub(pub *ecdsa.PublicKey) []byte

func GenerateKey

func GenerateKey() (*ecdsa.PrivateKey, error)

func HexToECDSA

func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error)

HexToECDSA parses a secp256k1 private key. HexToECDSA함수는 secp256k1 개인키를 파싱한다

func Keccak256

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

Keccak256 calculates and returns the Keccak256 hash of the input data. Keccak256은 입력 데이터에 대한 Keccak256 해시값을 계산하고 반환한다

func Keccak256Hash

func Keccak256Hash(data ...[]byte) (h common.Hash)

Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure. Keccak256Hash은 입력 데이터에 대한 Keccak256 해시값을 계산하고 반환하며, 반환값을 내부 해시 데이터 구조로 변환한다

func Keccak512

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

Keccak512 calculates and returns the Keccak512 hash of the input data. Keccak512은 입력 데이터에 대한 Keccak512 해시값을 계산하고 반환한다

func LoadECDSA

func LoadECDSA(file string) (*ecdsa.PrivateKey, error)

LoadECDSA loads a secp256k1 private key from the given file. LoadECDSA는 secp256k1 개인키를 주어진 파일로 부터 읽는다

func PubkeyToAddress

func PubkeyToAddress(p ecdsa.PublicKey) common.Address

func S256

func S256() elliptic.Curve

S256 returns an instance of the secp256k1 curve. S256은 secp256k1 커브의 인스턴스를 반환한다

func SaveECDSA

func SaveECDSA(file string, key *ecdsa.PrivateKey) error

SaveECDSA saves a secp256k1 private key to the given file with restrictive permissions. The key data is saved hex-encoded. SaveECDSA는 secp256k1 개인키를 주어진 파일에 제한된 권한으로 저장한다 키데이터는 헥사인코딩 된다

func SigToPub

func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)

SigToPub returns the public key that created the given signature. SigToPub은 주어진 서명으로부터 공개키를 반환한다

func Sign

func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error)

Sign calculates an ECDSA signature.

This function is susceptible to chosen plaintext attacks that can leak information about the private key that is used for signing. Callers must be aware that the given hash cannot be chosen by an adversery. Common solution is to hash any input before calculating the signature.

The produced signature is in the [R || S || V] format where V is 0 or 1. Sing함수는 ECDSA서명을 계산한다 이함수는 서명에 사용된 개인키에 대한 정보를 누출할수 있는 선택된 순정값 공격에 민감하다 호출자는 반드시 주어진 해시가 상대방에 의해 선택될수 없도록 고려해야한다 일반적인 해결책은 서명을 계산하기전 아무 인풋에대한 해시를 하는것이다.

func ToECDSA

func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)

ToECDSA creates a private key with the given D value. ToECDSA함수는 주어진 D값을 이용하여 프라이빗 키를 생성한다

func ToECDSAPub

func ToECDSAPub(pub []byte) *ecdsa.PublicKey

func ToECDSAUnsafe

func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey

ToECDSAUnsafe blindly converts a binary blob to a private key. It should almost never be used unless you are sure the input is valid and want to avoid hitting errors due to bad origin encoding (0 prefixes cut off). ToECDAUnsafe함수는 바이너리 블롭을 프라이빗키로 무조건 변환한다. 배드 오리진 인코딩때문에 발생하는 에러를 피하길 원한다면 인풋이 유효하다는 것이 확실하기 전에는 이함수를 사용하지 마라

func ValidateSignatureValues

func ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool

ValidateSignatureValues verifies whether the signature values are valid with the given chain rules. The v value is assumed to be either 0 or 1. ValidateSignatureValues는 시그니처 값들이 체인 룰에 적합한지 검증한다. v값은 0이거나 1로 가정한다

func VerifySignature

func VerifySignature(pubkey, hash, signature []byte) bool

VerifySignature checks that the given public key created signature over hash. The public key should be in compressed (33 bytes) or uncompressed (65 bytes) format. The signature should have the 64 byte [R || S] format. VerifySignature는 공개키가 해시를 통해 생성된 서명인지 검토한다 공개키는 반드시 33바이트로 압축되거나 65바이트의 비압축된 형태이다 서명은 반드시 64바이트의 [R || S] 형태여야 한다

Types

This section is empty.

Directories

Path Synopsis
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
cloudflare
Package bn256 implements a particular bilinear group at the 128-bit security level.
Package bn256 implements a particular bilinear group at the 128-bit security level.
google
Package bn256 implements a particular bilinear group at the 128-bit security level.
Package bn256 implements a particular bilinear group at the 128-bit security level.
Package secp256k1 wraps the bitcoin secp256k1 C library.
Package secp256k1 wraps the bitcoin secp256k1 C library.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.

Jump to

Keyboard shortcuts

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