crypto

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package crypto provides the file utilities. Use this package's utilities to prepare for uploading file and get data from downloaded files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalFileHash

func CalFileHash(f *os.File) (hash string, err error)

CalFileHash calculate the hash of file.

func DecryptFile

func DecryptFile(inFile, outFile *os.File, key []byte) (hash string, err error)

DecryptFile decrypt the file using AES-CTR. After decryption, calculate the hash of file.

func EncryptFile

func EncryptFile(inFile, outFile *os.File, keyAes []byte) (hash string, err error)

EncryptFile encrypt the file using AES-CTR. After encryption, calculate the hash of file.

func GenerateFileInfo

func GenerateFileInfo(target, publicKey, keyAes string, dataShards, parShards int) (info tpStorage.FileInfo, err error)

GenerateFileInfo generate the information of file for SeaStorage file system. If the size of file smaller than the default large file size limitation, the file will be split using RS erasure coding, else the file will keep origin

func MergeFile

func MergeFile(inPath string, hashes []string, outFile *os.File, originalSize, dataShards, parShards int) error

MergeFile merge fragments using Reed-solomon erasure coding.

func SplitFile

func SplitFile(inFile *os.File, outPath string, dataShards, parShards int) (hashes []string, fragmentSize int64, err error)

SplitFile split file using Reed-solomon erasure coding. After split, calculate each fragment's infos (hash & size).

Types

This section is empty.

Jump to

Keyboard shortcuts

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