data_management

package
v0.0.0-...-6e57485 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MPCPrime, _ = new(big.Int).SetString("340282366920938463463374607431768211507", 10)

MPCPrime is the prime used in the chosen Shamir secret sharing protocol used in SCALE-MAMBA

View Source
var MPCPrimeHalf = new(big.Int).Div(MPCPrime, big.NewInt(2))

Functions

func CreateSharesShamir

func CreateSharesShamir(input []*big.Int) ([][]*big.Int, error)

CreateSharesShamir is a helping function that splits a vector input into 3 random parts x_1, x_2, x_3, such that f(i) = x_i and f(0) = x, for a linear f

func CsvToVec

func CsvToVec(file string) ([]*big.Int, []string, []float64, error)

func CsvTxtToVec

func CsvTxtToVec(csvTxt string) ([]*big.Int, []string, error)

func DecVec

func DecVec(encVec string, pubKey, secKey []byte) ([]*big.Int, error)

func DeleteShare

func DeleteShare(filePath string) error

func DownloadShare

func DownloadShare(fileLink, filePath string) error

func EncryptVec

func EncryptVec(input []*big.Int, pubKey []byte) (string, error)

func FixIntToFloat

func FixIntToFloat(i int64) (x float64)

func FloatToFixInt

func FloatToFixInt(x float64) (int64, error)

FloatToFixInt changes a float to a fix precision representation of a number used in SCALE-MAMBA

func JoinSharesShamir

func JoinSharesShamir(input [][]*big.Int) ([]*big.Int, error)

func JoinSharesShamirFloat

func JoinSharesShamirFloat(input [][]*big.Int) []float64

func NewUniformRandomVector

func NewUniformRandomVector(n int, max *big.Int) ([]*big.Int, error)

func PrepareData

func PrepareData(inputsLinks []string, inputVecs []string, inputCols [][]string, nodeId int, sm string, params map[string]string, pubKey, secKey []byte) (int, int, int, []string, string)

func ReadShare

func ReadShare(file string, pubKey, secKey []byte, nodeId int) ([]*big.Int, []string, error)

func Readln

func Readln(r *bufio.Reader) (string, error)

func ReduceToCols

func ReduceToCols(input []*big.Int, colsAll []string, val string) ([]*big.Int, []string, error)

func ResultsToCsvText

func ResultsToCsvText(vec []float64, cols []string, funcName string) (string, error)

func SplitCsvFile

func SplitCsvFile(file, output string, pubKeys [][]byte) ([]float64, [][]*big.Int, []string, error)

Types

type VecEnc

type VecEnc struct {
	Key []byte
	Iv  []byte
	Val []byte
}

Jump to

Keyboard shortcuts

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