xx

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntToBytes

func IntToBytes(x int) []byte

IntToBytes converts an integer to big endian byte slice Because int can be 32 or 64 bits, it is always treated as 64 for the purposes of this function.

func NewID

func NewID(key GoRsa, salt []byte, idType id.Type) (*id.ID, error)

NewID creates a new ID by hashing the public key with a random 256-bit salt and appending the ID type. IDs are used by cMix to identify users, gateways, servers, and other network services (refer to id.Type)

func PublicKeyBytes

func PublicKeyBytes(key *rsa.PublicKey) []byte

PublicKeyBytes converts an RSA public key to a byte representation Specifically N's bytes concatenated with the public exponent concatenated at the end

Types

type GoRsa

type GoRsa interface {
	// GetGoRSA returns the public key in the standard Go crypto/rsa format.
	GetGoRSA() *rsa.PublicKey
}

GoRsa is an interface for an RSA implementation that may be used by NewID. The object adhering to this interface must have a method providing a rsa.PublicKey.

Jump to

Keyboard shortcuts

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