Documentation
¶
Index ¶
- func EvenCountForRange(startIdx, n int) int
- func EverySecondByte(chunk []byte, startIdx int) []byte
- func MaxReadable(evenAvail, oddAvail, startIdx, want int) int
- func MergeInterleaved(even, odd []byte, startIdx, n int) []byte
- func MergeInterleavedInto(even, odd []byte, startIdx int, dst []byte)
- func ReconstructCollect(partner, parity []byte, role RecoverRole, oddLength bool) ([]byte, error)
- func SplitStartIndices(globalByteIndex int) (startEven, startOdd int)
- type DecodeMeta
- type DecodeOptions
- type Decoder
- type EncodeMeta
- type EncodeOptions
- type Encoder
- type RecoverRole
- type Source
- type Sources
- type Writers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvenCountForRange ¶
EvenCountForRange returns even-stream bytes needed for n plaintext bytes at startIdx.
func EverySecondByte ¶
EverySecondByte returns every second byte of chunk starting at startIdx.
func MaxReadable ¶
MaxReadable returns the largest n <= want where even/odd streams have enough bytes.
func MergeInterleaved ¶
MergeInterleaved reconstructs n plaintext bytes from even/odd particle chunks.
func MergeInterleavedInto ¶
MergeInterleavedInto writes reconstructed bytes into dst[:n].
func ReconstructCollect ¶
func ReconstructCollect(partner, parity []byte, role RecoverRole, oddLength bool) ([]byte, error)
ReconstructCollect reads partner+parity fully and returns synthesized core bytes (tests).
func SplitStartIndices ¶
SplitStartIndices returns even/odd start indices for a chunk at globalByteIndex.
Types ¶
type DecodeMeta ¶
DecodeMeta captures streaming decode metadata.
func DecodeCollect ¶
func DecodeCollect(particles map[pcs.ParticleKind][]byte) ([]byte, *DecodeMeta, error)
DecodeCollect is a test helper that decodes in-memory particle+footer blobs.
type DecodeOptions ¶
type DecodeOptions struct {
StartOffset int64
}
DecodeOptions controls offset for streaming range reads.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reconstructs a document from six particle sources.
func NewDecoder ¶
NewDecoder creates a decoder with the given chunk size.
func (*Decoder) Decode ¶
func (d *Decoder) Decode(sources Sources, out io.Writer, opts DecodeOptions) (*DecodeMeta, error)
Decode reconstructs secret from six sources, verifying footers at end.
type EncodeMeta ¶
type EncodeMeta struct {
SHA256 [32]byte
Fingerprint *pcs.EncodeResult
BytesProcessed int64
}
EncodeMeta captures streaming encode metadata.
func EncodeCollect ¶
func EncodeCollect(secret, noise []byte, chunkSize int) (map[pcs.ParticleKind][]byte, *EncodeMeta, error)
EncodeCollect runs streaming encode into memory buffers (tests).
type EncodeOptions ¶
EncodeOptions controls footer fields stamped during streaming encode.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder streams PCS encode from a document reader to six particle writers.
func NewEncoder ¶
NewEncoder creates an encoder with cryptographically random noise.
func NewEncoderWithNoise ¶
NewEncoderWithNoise creates an encoder with deterministic noise (tests).
func (*Encoder) Encode ¶
func (e *Encoder) Encode(secret io.Reader, outs Writers, opts EncodeOptions) (*EncodeMeta, error)
Encode writes payloads and appends six v1 footers at EOF.
type RecoverRole ¶
type RecoverRole int
RecoverRole selects which core stream is synthesized from partner + parity.
const ( RecoverEven RecoverRole = iota RecoverOdd )