magic

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagicString    = "EFFUSE"
	VersionString  = "v1"
	DefaultSaltLen = 16
	IVLen          = 16
)

Variables

View Source
var (
	ErrInvalidMagic   = errors.New("missing header — file not recognized")
	ErrInvalidVersion = errors.New("corrupted file header or unsupported version")
	ErrShortRead      = errors.New("unexpected EOF while reading header")
)

Functions

func DetectFileType

func DetectFileType(data []byte, originalFilename string) string

DetectFileType determines the file extension using the mimetype library.

func WriteHeader

func WriteHeader(w io.Writer, iterations uint32, salt, iv []byte) error

Format: MAGIC(6 Byte) | VERSION(2 Byte) | ITER(4 Byte) | SALT_LEN(1 Byte) | SALT | IV(16 Byte)

Types

type Header struct {
	Iterations uint32
	Salt       []byte
	IV         []byte
}

func ReadHeader

func ReadHeader(r io.Reader) (*Header, error)

Jump to

Keyboard shortcuts

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