SecreC 2 language  2.8.0 (2023.09)
Language and standard library reference
Functions

Functions

template<domain D :shared3p , type T>
D T shuffle (D T[[1]] vec, D uint8[[1]] key)
 
template<domain D :shared3p >
D fix32 shuffle (D fix32[[1]] vec, D uint8[[1]] key)
 
template<domain D :shared3p >
D fix64 shuffle (D fix64[[1]] vec, D uint8[[1]] key)
 

Detailed Description

Protocols to shuffle an array with given key.

Note
D - shared3p protection domain
Precondition
the key is exactly 32 bytes long
Returns
a random permutation of the input array
Postcondition
the output is a permutation of the input
Note
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.
Leakage
None

Function Documentation

◆ shuffle() [1/3]

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

◆ shuffle() [2/3]

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

◆ shuffle() [3/3]

D T shuffle ( D T[[1]]  vec,
D uint8[[1]]  key 
)
Note
T - any data type
Parameters
vec- input array to shuffle
key- an uint8 type key that specifies the permutation