crypto

package
v0.0.0-...-19bcc65 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: AGPL-3.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CipherTag    = "<CipherKey>"
	Base64_16Len = 24
)

Variables

View Source
var DlfKey = []byte{
	65, 50, 114, 45, 208, 130, 239, 176, 220, 100, 87, 197, 118, 104, 202, 9,
}
View Source
var IV = make([]byte, 16) //nolint:gochecknoglobals,mnd // wontfix

Functions

func AESDecrypt

func AESDecrypt(key []byte, iv []byte, buf []byte) ([]byte, error)

func AESDecryptBase64

func AESDecryptBase64(keyBase64 string, iv []byte, buf []byte) error

func AESEncrypt

func AESEncrypt(key, plaintext []byte) ([]byte, error)

func DecodeCipherTag

func DecodeCipherTag(dlf []byte) ([]byte, error)

func DecryptDLF

func DecryptDLF(data []byte) ([]byte, error)

func GetDLFAuto

func GetDLFAuto(contentID string) ([]byte, error)

func GetOoaHash

func GetOoaHash(data []byte) []byte

func HashDirectory

func HashDirectory(folder string) (map[string]string, error)

func Murmur3X64_128Hash

func Murmur3X64_128Hash(seed int, str string) uint64

func Murmur3X86_128Hash

func Murmur3X86_128Hash(seed int, str string) uint32

func Murmur3X86_32Hash

func Murmur3X86_32Hash(seed int, str string) uint32

func NewCRC32

func NewCRC32(filePath string) (string, error)

func NewCRC64

func NewCRC64(filePath string) (string, error)

func NewHash

func NewHash(filePath string, hash hash.Hash) (string, error)

func NewMD5

func NewMD5(filePath string) (string, error)

func NewSHA1

func NewSHA1(filePath string) (string, error)

func NewSHA256

func NewSHA256(filePath string) (string, error)

func NewSHA512

func NewSHA512(filePath string) (string, error)

func Validate

func Validate(filePath, fileHash string, hash hash.Hash) error

Types

type DiffData

type DiffData struct {
	Hashes DiffHashData
	Local  DiffLocalData
}

func DiffDirectory

func DiffDirectory(fileHashesA, fileHashesB map[string]string, folderA, folderB string) []DiffData

type DiffHashData

type DiffHashData struct {
	File  string
	PathA string
	PathB string
	HashA string
	HashB string
}

type DiffLocalData

type DiffLocalData struct {
	Path    string
	ExistsA string
	ExistsB string
}

Jump to

Keyboard shortcuts

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