shared3p_permutation.sc

shared3p_permutation.sc

Module with procedures for permuting vectors and matrices.

Functions:

applyPrivatePermutation

Permute a vector according to a private permutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

x

- vector to be permuted

p

- permutation. Output at index i will be x[p[i]].

x permuted according to permutation p

None

Function Overloads

D T applyPrivatePermutation(D T[[1]] data, D uint[[1]] p)

applyPrivatePermutationCols

Permute matrix columns according to a private permutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output column at index i will be X[:, p[i]].

X where columns have been permuted according to permutation p

None

Function Overloads

D T applyPrivatePermutationCols(D T[[2]] data, D uint[[1]] p)

applyPrivatePermutationRows

Permute matrix rows according to a private permutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output row at index i will be X[p[i], :].

X where rows have been permuted according to permutation p

None

Function Overloads

D T applyPrivatePermutationRows(D T[[2]] data, D uint[[1]] p)

applyPublicPermutation

Permute a vector according to a public permutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

x

- vector to be permuted

p

- permutation. Output at index i will be x[p[i]].

x permuted according to permutation p

None

Function Overloads

D T applyPublicPermutation(D T[[1]] x, uint[[1]] p)

applyPublicPermutationCols

Permute matrix columns according to a public permutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output column at index i will be X[:, p[i]].

X where columns have been permuted according to permutation p

None

Function Overloads

D T applyPublicPermutationCols(D T[[2]] X, uint[[1]] p)

applyPublicPermutationRows

Permute matrix rows according to a public permutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output row at index i will be X[p[i], :].

X where rows have been permuted according to permutation p

None

Function Overloads

D T applyPublicPermutationRows(D T[[2]] X, uint[[1]] p)

inversePermutation

Calculate inverse permutation from a permutation.

Detailed Description

Supported types - uint64

Parameters

permutation

- permutation

returns inverse permutation of permutation

Function Overloads

uint inversePermutation(uint[[1]] permutation)

privateRandomPermutation

Generates a random private permutation.

Detailed Description

D - shared3p protection domain

Parameters

n

- length of the permutation

a random permutation of length n

Function Overloads

D uint privateRandomPermutation(uint n)

publicRandomPermutation

Generates a random public permutation.

Detailed Description

D - shared3p protection domain

This procedure actually generates a uint32 permutation vector which is converted to uint64. It does not work when n > UINT32_MAX.

Parameters

domainProxy

- a value used to indicate the shared3p domain used for generating shared randomness by the procedure. The value of this parameter is not important.

n

- length of the permutation

a random permutation of length n

Function Overloads

uint publicRandomPermutation(D uint domainProxy, uint n)

unapplyPrivatePermutation

Permute a vector according to a private permutation. Reverses the effect of applyPrivatePermutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

x

- vector to be permuted

p

- permutation. Output at index p[i] will be x[i].

x permuted according to permutation p

None

Function Overloads

D T unapplyPrivatePermutation(D T[[1]] x, D uint[[1]] p)

unapplyPrivatePermutationCols

Permute matrix columns according to a private permutation. Reverses the effect of applyPrivatePermutationCols.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output column at index p[i] will be X[:, i].

X where columns have been permuted according to permutation p

None

Function Overloads

D T unapplyPrivatePermutationCols(D T[[2]] X, D uint[[1]] p)

unapplyPrivatePermutationRows

Permute matrix rows according to a private permutation. Reverses the effect of applyPrivatePermutationRows.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output row at index p[i] will be X[i, :].

X where rows have been permuted according to permutation p

None

Function Overloads

D T unapplyPrivatePermutationRows(D T[[2]] X, D uint[[1]] p)

unapplyPublicPermutation

Permute a vector according to a public permutation. Reverses the effect of applyPublicPermutation.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output at index p[i] will be x[i].

x permuted according to permutation p

None

Function Overloads

D T unapplyPublicPermutation(D T[[1]] x, uint[[1]] p)

unapplyPublicPermutationCols

Permute matrix columns according to a public permutation. Reverses the effect of applyPublicPermutationCols.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output column at index p[i] will be X[:, i].

X where columns have been permuted according to permutation p

None

Function Overloads

D T unapplyPublicPermutationCols(D T[[2]] X, uint[[1]] p)

unapplyPublicPermutationRows

Permute matrix rows according to a public permutation. Reverses the effect of applyPublicPermutationRows.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / float32 / float64 / fix32 / fix64

Parameters

X

- matrix to be permuted

p

- permutation. Output row at index p[i] will be X[i, :].

X where rows have been permuted according to permutation p

None

Function Overloads

D T unapplyPublicPermutationRows(D T[[2]] X, uint[[1]] p)