Click or drag to resize
gmp_libmpn_sec_tabselect Method
Select entry which from table tab, which has nents entries, each n limbs. Store the selected entry at rp.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static void mpn_sec_tabselect(
	mp_ptr rp,
	mp_ptr tab,
	mp_size_t n,
	mp_size_t nents,
	mp_size_t which
)

Parameters

rp
Type: Math.Gmp.Nativemp_ptr
The result integer.
tab
Type: Math.Gmp.Nativemp_ptr
The table of operand integers.
n
Type: Math.Gmp.Nativemp_size_t
The number of limbs in each entry of the table.
nents
Type: Math.Gmp.Nativemp_size_t
The number of entries in the table.
which
Type: Math.Gmp.Nativemp_size_t
The zero-based index of the entry to select.
Remarks

This function reads the entire table to avoid side-channel information leaks.

Examples
// Create multi-precision operands, and expected result.
mp_ptr tab = new mp_ptr(new uint[] { 0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x33333333, 0x00000000 });
mp_ptr result = new mp_ptr(new uint[] { 0x33333333 });
mp_ptr rp = new mp_ptr(result.Size);

// Set rp to third entry in tab.
gmp_lib.mpn_sec_tabselect(rp, tab, 1, tab.Size, 2);

// Assert result of operation.
Assert.IsTrue(rp.SequenceEqual(result));

// Release unmanaged memory.
gmp_lib.free(tab, result);
See Also