pathiv

package
v0.0.0-...-ece74ff Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockIV

func BlockIV(block0iv []byte, blockNo uint64) []byte

BlockIV returns the block IV for block number "blockNo". "block0iv" is the block IV of block #0.

func Derive

func Derive(path string, purpose Purpose) []byte

Derive derives an IV from an encrypted path by hashing it with sha256

Types

type FileIVs

type FileIVs struct {
	ID       []byte
	Block0IV []byte
}

FileIVs contains both IVs that are needed to create a file.

func DeriveFile

func DeriveFile(path string) (fileIVs FileIVs)

DeriveFile derives both IVs that are needed to create a file and returns them in a container struct.

type Purpose

type Purpose string

Purpose identifies for which purpose the IV will be used. This is mixed into the derivation.

const (
	// PurposeDirIV means the value will be used as a directory IV
	PurposeDirIV Purpose = "DIRIV"
	// PurposeFileID means the value will be used as the file ID in the file header
	PurposeFileID Purpose = "FILEID"
	// PurposeSymlinkIV means the value will be used as the IV for symlink encryption
	PurposeSymlinkIV Purpose = "SYMLINKIV"
	// PurposeBlock0IV means the value will be used as the IV of ciphertext block #0.
	PurposeBlock0IV Purpose = "BLOCK0IV"
)

Jump to

Keyboard shortcuts

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