sig

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Unlicense Imports: 7 Imported by: 0

Documentation

Overview

Package sig provides functions to Sign hashes of messages, generating a standard compact 65 byte Signature and recover the 33 byte pub.Key embedded in it. This is used as a MAC for Indra packets to associate messages with Indra peers' sessions.

Index

Constants

View Source
const Len = 65

Len is the length of the signatures used in Indra, compact keys that can have the public key extracted from them, thus eliminating the need to separately specify it in messages.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes [Len]byte

Bytes is an ECDSA BIP62 formatted compact signature which allows the recovery of the public key from the signature. This allows messages to avoid adding extra bytes to also specify the public key of the signer.

func Sign

func Sign(prv *prv.Key, hash sha256.Hash) (sig Bytes, e error)

Sign produces an ECDSA BIP62 compact signature.

func (Bytes) Recover

func (sig Bytes) Recover(hash sha256.Hash) (p *pub.Key, e error)

Recover the public key corresponding to the signing private key used to create a signature on the hash of a message.

Jump to

Keyboard shortcuts

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