Documentation ¶
Overview ¶
Package ed25519 implements the Ed25519 signature algorithm. See https://ed25519.cr.yp.to/.
These functions are also compatible with the “Ed25519” function defined in RFC 8032. However, unlike RFC 8032's formulation, this package's private key representation includes a public key suffix to make multiple signing operations with the same key more efficient. This package refers to the RFC 8032 private key as the “seed”.
This is a interface adaptation of the original file.
Index ¶
- Constants
- Variables
- func EncodeHash(h Hash) string
- func IsValidPrivateKey(data []byte) bool
- func NewCipherKey() []byte
- func Nonce() []byte
- func RandomAsymetricKey() (Token, PrivateKey)
- type Address
- type Cipher
- type CipherNonce
- type Hash
- type PrivateKey
- type Signature
- type Token
- func (t Token) Address() Address
- func (t Token) Equal(another Token) bool
- func (t Token) Equals(bytes []byte) bool
- func (t Token) Hex() string
- func (t Token) IsLike(a Address) bool
- func (t Token) Larger(another Token) bool
- func (t Token) MarshalText() (text []byte, err error)
- func (t Token) String() string
- func (t Token) UnmarshalText(text []byte) error
- func (t Token) Verify(msg []byte, signature Signature) bool
- type TokenCipher
- type TokenCiphers
- type TokenValue
Constants ¶
View Source
const ( NonceSize = 12 Size = sha256.Size CipherKeySize = 32 CipherSize = NonceSize + CipherKeySize PublicKeySize = 32 TokenSize = 32 PrivateKeySize = 64 SignatureSize = 64 )
View Source
const AddressSize = 20
Variables ¶
View Source
var ErrPrivateKeyParse = errors.New("could not parse private key")
View Source
var ErrPublicKeyParse = errors.New("could not parse public key")
Functions ¶
func EncodeHash ¶
func IsValidPrivateKey ¶
func NewCipherKey ¶
func NewCipherKey() []byte
func RandomAsymetricKey ¶
func RandomAsymetricKey() (Token, PrivateKey)
Types ¶
type CipherNonce ¶
type CipherNonce struct {
// contains filtered or unexported fields
}
func CipherNonceFromKey ¶
func CipherNonceFromKey(key []byte) CipherNonce
func (CipherNonce) OpenNewNonce ¶
func (c CipherNonce) OpenNewNonce(msg []byte, nonce []byte) ([]byte, error)
func (CipherNonce) Seal ¶
func (c CipherNonce) Seal(msg []byte) []byte
func (CipherNonce) SealWithNewNonce ¶
func (c CipherNonce) SealWithNewNonce(msg []byte) ([]byte, []byte)
func (CipherNonce) SetNonce ¶
func (c CipherNonce) SetNonce(nonce []byte)
type Hash ¶
var ZeroValueHash Hash
func BytesToHash ¶
func DecodeHash ¶
func (Hash) MarshalText ¶
func (Hash) UnmarshalText ¶
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
var ZeroPrivateKey PrivateKey
func ParsePEMPrivateKey ¶
func ParsePEMPrivateKey(data []byte) (PrivateKey, error)
func PrivateKeyFromSeed ¶
func PrivateKeyFromSeed(seed [32]byte) PrivateKey
func (PrivateKey) Hex ¶
func (p PrivateKey) Hex() string
func (PrivateKey) PublicKey ¶
func (p PrivateKey) PublicKey() Token
func (PrivateKey) Sign ¶
func (p PrivateKey) Sign(msg []byte) Signature
type Signature ¶
type Signature [SignatureSize]byte
var ZeroSignature Signature
func (Signature) MarshalText ¶
func (Signature) UnmarshalText ¶
type Token ¶
var ZeroToken Token
func ParsePEMPublicKey ¶
func TokenFromString ¶
func (Token) MarshalText ¶
func (Token) UnmarshalText ¶
type TokenCipher ¶
type TokenCiphers ¶
type TokenCiphers []TokenCipher
type TokenValue ¶
Directories ¶
Path | Synopsis |
---|---|
curve25519
Package curve25519 provides an implementation of the X25519 function, which performs scalar multiplication on the elliptic curve known as Curve25519.
|
Package curve25519 provides an implementation of the X25519 function, which performs scalar multiplication on the elliptic curve known as Curve25519. |
curve25519/internal/field
Package field implements fast arithmetic modulo 2^255-19.
|
Package field implements fast arithmetic modulo 2^255-19. |
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
|
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. |
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (https://www.tarsnap.com/scrypt/scrypt.pdf).
|
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (https://www.tarsnap.com/scrypt/scrypt.pdf). |
Click to show internal directories.
Click to hide internal directories.