Documentation ¶
Index ¶
- Constants
- func CalcCRC32(data []byte) uint32
- func CalcCRC32OfSlices(data [][]byte) uint32
- func CalcFileCRC32(filePath string) (uint32, error)
- func CalcFileHash(filePath, encryptionTag string, codec byte) (string, error)
- func CalcFileHashFromSlices(files []string, encryptionTag string) string
- func CalcFileKeccak(filePath string) (mh.Multihash, error)
- func CalcFileMD5(filePath string) ([]byte, error)
- func CalcHash(data []byte) string
- func CalcHashBytes(data []byte) []byte
- func CalcKeccakOfSplitFiles(files []string) []byte
- func CalcMD5OfSplitFiles(filePath []string) ([]byte, error)
- func CalcSliceHash(data []byte, fileHash string, sliceNumber uint64) (string, error)
- func FromECDSAPub(pub *ecdsa.PublicKey) []byte
- func GetCodecFromFileHash(hash string) (uint64, error)
- func IsVideoStream(hash string) bool
- func Keccak256(data ...[]byte) []byte
- func S256() elliptic.Curve
- func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey
- func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error)
- func ValidateHash(hash string) bool
Constants ¶
View Source
const ( VIDEO_CODEC = 0x72 // VIDEO_CODEC is separate from SDS_CODEC in order to identify the videos SDS_CODEC = 0x66 // codec of legacy file hash is cid.RAW. New file hash uses SDS_CODEC. VALID_CID_VERSION = 1 VALID_MH_TYPE = 27 VALID_MH_LENGTH = 20 )
Variables ¶
This section is empty.
Functions ¶
func CalcCRC32OfSlices ¶
func CalcFileCRC32 ¶
func CalcFileHashFromSlices ¶
func CalcFileMD5 ¶
func CalcHashBytes ¶
func CalcKeccakOfSplitFiles ¶
func CalcMD5OfSplitFiles ¶
func CalcSliceHash ¶
func FromECDSAPub ¶
func GetCodecFromFileHash ¶
func IsVideoStream ¶
func ToECDSAUnsafe ¶
func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey
ToECDSAUnsafe blindly converts a binary blob to a private key. It should almost never be used unless you are sure the input is valid and want to avoid hitting errors due to bad origin encoding (0 prefixes cut off).
func UnmarshalPubkey ¶
UnmarshalPubkey converts bytes to a secp256k1 public key.
func ValidateHash ¶
ValidateHash only validate the hash format, does NOT verify if the hash is created by certain content
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
common
Package common contains various helper functions.
|
Package common contains various helper functions. |
common/hexutil
Package hexutil implements hex encoding with 0x prefix.
|
Package hexutil implements hex encoding with 0x prefix. |
secp256k1
Package secp256k1 wraps the bitcoin secp256k1 C library.
|
Package secp256k1 wraps the bitcoin secp256k1 C library. |
Package math provides integer math utilities.
|
Package math provides integer math utilities. |
Package rlp implements the RLP serialization format.
|
Package rlp implements the RLP serialization format. |
internal/rlpstruct
Package rlpstruct implements struct processing for RLP encoding/decoding.
|
Package rlpstruct implements struct processing for RLP encoding/decoding. |
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202. |
Click to show internal directories.
Click to hide internal directories.