Categorygithub.com/filecoin-project/go-fil-commp-hashhash

# README

go-fil-commp-hashhash

A hash.Hash implementation of fil-commitment-unsealed

GoDoc GoReport

Package commp allows calculating a Filecoin Unsealed Commitment (commP/commD) given a bytestream. It is implemented as a standard hash.Hash() interface, with the entire padding and treebuilding algorithm written in golang.

The returned digest is a 32-byte raw commitment payload. Use something like DataCommitmentV1ToCID in order to convert it to a proper cid.Cid.

The output of this library is 100% identical to ffi.GeneratePieceCIDFromFile()

Lead Maintainer

Peter 'ribasushi' Rabbitson

License

SPDX-License-Identifier: Apache-2.0 OR MIT

# Functions

PadCommP is experimental, do not use it.

# Constants

result of log2( 64 GiB / 32 ).
MaxPiecePayload is the maximum amount of data that one can Write() to the Calc object, before needing to derive a Digest().
MaxPieceSize is the current maximum size of the rust-fil-proofs proving tree.
MinPiecePayload is the smallest amount of data for which FR32 padding has a defined result.

# Structs

Calc is an implementation of a commP "hash" calculator, implementing the familiar hash.Hash interface.