dhash

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateValueKey

func CreateValueKey(pid peer.ID, ctxID []byte) []byte

CreateValueKey creates value key from peer ID and context ID

func DecryptAES

func DecryptAES(nonce, payload, passphrase []byte) ([]byte, error)

DecryptAES decrypts AES payload using the nonce and the passphrase

func DecryptMetadata

func DecryptMetadata(encMetadata, valueKey []byte) ([]byte, error)

DecryptMetadata decrypts metdata using the provided passphrase

func DecryptValueKey

func DecryptValueKey(valKey, mh multihash.Multihash) ([]byte, error)

DecryptValueKey decrypts the value key using the passphrase

func EncryptAES

func EncryptAES(payload, passphrase []byte) ([]byte, []byte, error)

encryptAES uses AESGCM to encrypt the payload with the passphrase and a nonce derived from it. returns nonce and encrypted bytes.

func EncryptMetadata

func EncryptMetadata(metadata, valueKey []byte) ([]byte, error)

EncryptMetadata encrypts metadata using the provided passphrase

func EncryptValueKey

func EncryptValueKey(valKey, mh multihash.Multihash) ([]byte, error)

EncryptValueKey encrypts raw value key using the passpharse

func SHA256

func SHA256(payload, dest []byte) []byte

SecondSHA returns SHA256 over the payload

func SecondMultihash

func SecondMultihash(mh multihash.Multihash) multihash.Multihash

SecondMultihash calculates SHA256 over the multihash and wraps it into another multihash with DBL_SHA256 codec.

func SplitValueKey

func SplitValueKey(valKey []byte) (peer.ID, []byte, error)

SplitValueKey splits value key into original components

Types

This section is empty.

Jump to

Keyboard shortcuts

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