shared3p_random.sc

shared3p_random.sc

Module with functions for randomizing values.

Functions:

randomize

Function for randomizing values.

Detailed Description

D - shared3p protection domain

Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int / xor_uint8 / xor_uint16 / xor_uint32 / xor_uint64

Parameters

arr

- an array of any dimension

returns an array with randomized values

None

Function Overloads

D bool randomize(D bool[[N]] arr)

D uint8 randomize(D uint8[[N]] arr)

D uint16 randomize(D uint16[[N]] arr)

D uint32 randomize(D uint32[[N]] arr)

D uint randomize(D uint[[N]] arr)

D int8 randomize(D int8[[N]] arr)

D int16 randomize(D int16[[N]] arr)

D int32 randomize(D int32[[N]] arr)

D int randomize(D int[[N]] arr)

D xor_uint8 randomize(D xor_uint8[[N]] arr)

D xor_uint16 randomize(D xor_uint16[[N]] arr)

D xor_uint32 randomize(D xor_uint32[[N]] arr)

D xor_uint64 randomize(D xor_uint64[[N]] arr)

D fix32 randomize(D fix32[[N]] arr)

D fix64 randomize(D fix64[[N]] arr)

shuffle

Functions for shuffling values.

Functions:

D - shared3p protection domain

T - any data type

inverseShuffle(key)

Protocols to undo the shuffle of an array with given key.

Detailed Description

D - shared3p protection domain

the key is exactly 32 bytes long

the inverse of the permutation of the input array, defined by the key

the output is a permutation of the input

the declassified value of the key does not matter, internally only the shares are used. If two vectors are shuffled using the same key the permutation applied is the same as long as the vectors are of the same length, and the key does not get reshared.

None

Function Overloads

D T inverseShuffle(D T[[1]] vec, D uint8[[1]] key)

T - any data type

Parameters

vec

- input array to shuffle

key

- an uint8 type key that specifies the permutation

D fix32 inverseShuffle(D fix32[[1]] vec, D uint8[[1]] key)

D fix64 inverseShuffle(D fix64[[1]] vec, D uint8[[1]] key)

inverseShuffleColumns(key)

Protocols to undo the shuffle of columns in a matrix with given key.

Detailed Description

D - shared3p protection domain

the key is exactly 32 bytes long

the inverse of the permutation of the input matrix, defined by the key

the output matrixes columns are a permutation of the input

the declassified value of the key does not matter, internally only the shares are used. If two vectors are shuffled using the same key the permutation applied is the same as long as the vectors are of the same length, and the key does not get reshared.

None

Function Overloads

D T inverseShuffleColumns(D T[[2]] mat, D uint8[[1]] key)

T - any data type

Parameters

mat

- input matrix to shuffle

key

- an uint8 type key that specifies the permutation

inverseShuffleRows(key)

Protocols to undo the shuffling of rows in a matrix with given key.

Detailed Description

D - shared3p protection domain

the key is exactly 32 bytes long

the inverse of the permutation of the input matrix, defined by the key

the output matrices rows are a permutation of the input

the declassified value of the key does not matter, internally only the shares are used. If two vectors are shuffled using the same key the permutation applied is the same as long as the vectors are of the same length, and the key does not get reshared.

None

Function Overloads

D T inverseShuffleRows(D T[[2]] mat, D uint8[[1]] key)

T - any data type

Parameters

mat

- input matrix to shuffle

key

- an uint8 type key that specifies the permutation

D fix32 inverseShuffleRows(D fix32[[2]] mat, D uint8[[1]] key)

D fix64 inverseShuffleRows(D fix64[[2]] mat, D uint8[[1]] key)

shuffle

Function for shuffling values.

Detailed Description

D - shared3p protection domain

returns a shuffled vector

None

Function Overloads

D T shuffle(D T[[1]] vec)

T - any data type

Parameters

vec

- a vector of supported type

D fix32 shuffle(D fix32[[1]] vec)

D fix64 shuffle(D fix64[[1]] vec)

shuffle(key)

Protocols to shuffle an array with given key.

Detailed Description

D - shared3p protection domain

the key is exactly 32 bytes long

a random permutation of the input array

the output is a permutation of the input

the declassified value of the key does not matter, internally only the shares are used. If two vectors are shuffled using the same key the permutation applied is the same as long as the vectors are of the same length, and the key does not get reshared.

None

Function Overloads

D T shuffle(D T[[1]] vec, D uint8[[1]] key)

T - any data type

Parameters

vec

- input array to shuffle

key

- an uint8 type key that specifies the permutation

D fix32 shuffle(D fix32[[1]] vec, D uint8[[1]] key)

D fix64 shuffle(D fix64[[1]] vec, D uint8[[1]] key)

shuffleColumns

Function for shuffling columns in a matrix.

Detailed Description

D - shared3p protection domain

returns a matrix with shuffled columns

None

Function Overloads

D T shuffleColumns(D T[[2]] mat)

T - any data type

Parameters

mat

- a matrix of any type

shuffleColumns(key)

Protocols to shuffle columns in a matrix with given key.

Detailed Description

D - shared3p protection domain

the key is exactly 32 bytes long

a random permutation of the input matrix

the output matrixes columns are a permutation of the input

the declassified value of the key does not matter, internally only the shares are used. If two vectors are shuffled using the same key the permutation applied is the same as long as the vectors are of the same length, and the key does not get reshared.

None

Function Overloads

D T shuffleColumns(D T[[2]] mat, D uint8[[1]] key)

T - any data type

Parameters

mat

- input matrix to shuffle

key

- an uint8 type key that specifies the permutation

shuffleRows

Function for shuffling rows in a matrix.

Detailed Description

D - shared3p protection domain

returns a matrix with shuffled rows

None

Function Overloads

D T shuffleRows(D T[[2]] mat)

T - any data type

Parameters

mat

- a matrix of any type

D fix32 shuffleRows(D fix32[[2]] mat)

D fix64 shuffleRows(D fix64[[2]] mat)

shuffleRows(key)

Protocols to shuffle rows in a matrix with given key.

Detailed Description

D - shared3p protection domain

the key is exactly 32 bytes long

a random permutation of the input matrix

the output matrices rows are a permutation of the input

the declassified value of the key does not matter, internally only the shares are used. If two vectors are shuffled using the same key the permutation applied is the same as long as the vectors are of the same length, and the key does not get reshared.

None

Function Overloads

D T shuffleRows(D T[[2]] mat, D uint8[[1]] key)

T - any data type

Parameters

mat

- input matrix to shuffle

key

- an uint8 type key that specifies the permutation

D fix32 shuffleRows(D fix32[[2]] mat, D uint8[[1]] key)

D fix64 shuffleRows(D fix64[[2]] mat, D uint8[[1]] key)