gmp_libmpn_sec_powm Method |
Set R to (B^E) modulo M, where R = {
rp,
n}, M = {
mp,
n}, and E = {
ep, ceil(
enb /
mp_bits_per_limb)}.
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_powm(
mp_ptr rp,
mp_ptr bp,
mp_size_t bn,
mp_ptr ep,
mp_bitcnt_t enb,
mp_ptr mp,
mp_size_t n,
mp_ptr tp
)
Public Shared Sub mpn_sec_powm (
rp As mp_ptr,
bp As mp_ptr,
bn As mp_size_t,
ep As mp_ptr,
enb As mp_bitcnt_t,
mp As mp_ptr,
n As mp_size_t,
tp As mp_ptr
)
public:
static void mpn_sec_powm(
mp_ptr^ rp,
mp_ptr^ bp,
mp_size_t bn,
mp_ptr^ ep,
mp_bitcnt_t enb,
mp_ptr^ mp,
mp_size_t n,
mp_ptr^ tp
)
static member mpn_sec_powm :
rp : mp_ptr *
bp : mp_ptr *
bn : mp_size_t *
ep : mp_ptr *
enb : mp_bitcnt_t *
mp : mp_ptr *
n : mp_size_t *
tp : mp_ptr -> unit
Parameters
- rp
- Type: Math.Gmp.Nativemp_ptr
The result operand. - bp
- Type: Math.Gmp.Nativemp_ptr
The first operand integer. - bn
- Type: Math.Gmp.Nativemp_size_t
The number of limbs of bp. - ep
- Type: Math.Gmp.Nativemp_ptr
The second operand integer. - enb
- Type: Math.Gmp.Nativemp_bitcnt_t
The number of limbs of ep. - mp
- Type: Math.Gmp.Nativemp_ptr
The third operand integer. - n
- Type: Math.Gmp.Nativemp_size_t
The number of limbs of mp. - tp
- Type: Math.Gmp.Nativemp_ptr
The scratch operand integer.
Remarks
It is required that B > 0, that M > 0 is odd, and that E < 2^enb.
No overlapping between R and the input operands is allowed.
This function requires scratch space of mpn_sec_powm_itch(bn, enb, n)
limbs to be passed in the tp parameter.
The scratch space requirements are guaranteed to increase monotonously in the operand sizes.
Examples
mp_ptr bp = new mp_ptr(new uint[] { 0x00000002 });
mp_ptr ep = new mp_ptr(new uint[] { 0x00000004 });
mp_ptr mp = new mp_ptr(new uint[] { 0x00000003 });
mp_ptr result = new mp_ptr(new uint[] { 0x00000001 });
mp_ptr rp = new mp_ptr(bp.Size);
mp_size_t size = gmp_lib.mpn_sec_powm_itch(bp.Size, 3, mp.Size);
mp_ptr tp = new mp_ptr(size);
gmp_lib.mpn_sec_powm(rp, bp, bp.Size, ep, 3, mp, mp.Size, tp);
Assert.IsTrue(rp.SequenceEqual(result));
gmp_lib.free(rp, bp, ep, mp, tp, result);
Dim bp As New mp_ptr(New UInteger() { &H2})
Dim ep As New mp_ptr(New UInteger() { &H4})
Dim mp As New mp_ptr(New UInteger() { &H3})
Dim result As New mp_ptr(New UInteger() { &H1})
Dim rp As New mp_ptr(bp.Size)
Dim size As mp_size_t = gmp_lib.mpn_sec_powm_itch(bp.Size, 3, mp.Size)
Dim tp As New mp_ptr(size)
gmp_lib.mpn_sec_powm(rp, bp, bp.Size, ep, 3, mp, mp.Size, tp)
Assert.IsTrue(rp.SequenceEqual(result))
gmp_lib.free(rp, bp, ep, mp, tp, result)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also