utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package utils exports mostly used functions in cryptomony library

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrI2OSPIntegerTooLarge returns when integer's bit length larger than requested length
	ErrI2OSPIntegerTooLarge = errors.New("i2osp: integer too large")
	// ErrI2OSPIntegerNegative returns when given integer is negative
	ErrI2OSPIntegerNegative = errors.New("i2osp: negative integer")
)

Functions

func Concat

func Concat(inputs ...[]byte) []byte

Concat concatenates multiple byte slice to one byte slice

func I2osp

func I2osp(x *big.Int, xLen int) ([]byte, error)

I2osp converts a nonnegative integer to an octet string of a specified length.

Reference: (https://datatracker.ietf.org/doc/html/rfc8017#section-4.1)

func Os2ip

func Os2ip(x []byte) int

Os2ip converts an octet string to a nonnegative integer.

Reference: (https://datatracker.ietf.org/doc/html/rfc8017#section-4.2)

func RandomBytes

func RandomBytes(length int) []byte

RandomBytes returns random bytes of with given length (wrapper for crypto/rand).

Types

This section is empty.

Jump to

Keyboard shortcuts

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