feck

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShardsTotal    = 9
	ShardsRequired = 3
)

Variables

This section is empty.

Functions

func AppendChecksum

func AppendChecksum(in []byte) []byte

func BytesToUint64

func BytesToUint64(bytes []byte) uint64

BytesToUint64 - converts 4 byte slice to uint32

func PadData

func PadData(data []byte, required, total int) []byte

padData appends a 2 byte length prefix, and pads to a multiple of total. Note that the 16 bit prefix limits max chunk size to 64kb, thus creating a max of 64kb * number of required shares. If the data length is greater than this, the function returns an nil slice to indicate error

func Split

func Split(data []byte, required, total int) [][]byte

func Uint64ToBytes

func Uint64ToBytes(input uint64) []byte

Uint64ToBytes - returns a byte slice from uint64 - required because Murmur3 takes bytes as input but returns uint32

func UnpadData

func UnpadData(data []byte) (out []byte)

UnpadData reverses the padding applied in PadData by reading the length prefix and slicing off the extra bytes

func VerifyChecksum

func VerifyChecksum(in []byte) (out []byte, verified bool)

func ZeroBytes

func ZeroBytes(b []byte)

Types

type RS

type RS struct {
	*reedsolomon.RS
	// contains filtered or unexported fields
}

func New

func New(required, total int) *RS

func (*RS) Decode

func (r *RS) Decode(shards [][]byte) (out []byte)

func (*RS) Encode

func (r *RS) Encode(data []byte) [][]byte

Jump to

Keyboard shortcuts

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