diff options
author | Jack Lloyd <[email protected]> | 2017-03-31 16:04:22 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-03-31 16:04:22 -0400 |
commit | db73b2e64c344836afd2160f0610e350bb07da2e (patch) | |
tree | 934a7605121c396c262ebd832e220a1b36416ff9 /doc/manual/ffi.rst | |
parent | 074bc5ad520397793f83c84c762da38b39fbf36b (diff) |
Add some more useful bigint functions to C interface
Diffstat (limited to 'doc/manual/ffi.rst')
-rw-r--r-- | doc/manual/ffi.rst | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/doc/manual/ffi.rst b/doc/manual/ffi.rst index d53bdb977..61b61b7b1 100644 --- a/doc/manual/ffi.rst +++ b/doc/manual/ffi.rst @@ -251,7 +251,6 @@ Multiple Precision Integers Free a ``botan_mp_t`` - .. cpp:function:: int botan_mp_to_hex(botan_mp_t mp, char* out) Writes exactly ``botan_mp_num_bytes(mp)*2 + 1`` bytes to out @@ -321,6 +320,30 @@ Multiple Precision Integers Return 1 if ``x`` is equal to ``y``, 0 if ``x`` is not equal to ``y`` +.. cpp:function:: int botan_mp_is_zero(const botan_mp_t x) + + Return 1 if ``x`` is equal to zero, otherwise 0. + +.. cpp:function:: int botan_mp_is_odd(const botan_mp_t x) + + Return 1 if ``x`` is odd, otherwise 0. + +.. cpp:function:: int botan_mp_is_even(const botan_mp_t x) + + Return 1 if ``x`` is even, otherwise 0. + +.. cpp:function:: int botan_mp_is_positive(const botan_mp_t x) + + Return 1 if ``x`` is greater than or equal to zero. + +.. cpp:function:: int botan_mp_is_negative(const botan_mp_t x) + + Return 1 if ``x`` is less than zero. + +.. cpp:function:: int botan_mp_to_uint32(const botan_mp_t x, uint32_t* val) + + If x fits in a 32-bit integer, set *val to it and return 0. + .. cpp:function:: int botan_mp_cmp(int* result, botan_mp_t x, botan_mp_t y) Three way comparison: set result to -1 if ``x`` is less than ``y``, @@ -367,10 +390,18 @@ Multiple Precision Integers ``test_prob`` is 64, then sufficient Miller-Rabin iterations will run to assure there is at most a ``1/2**64`` chance that ``n`` is composit. -.. cpp:function:: int botan_mp_bit_set(botan_mp_t n, size_t bit) +.. cpp:function:: int botan_mp_get_bit(botan_mp_t n, size_t bit) Returns 0 if the specified bit of ``n`` is not set, 1 if it is set. +.. cpp:function:: int botan_mp_set_bit(botan_mp_t n, size_t bit) + + Set the specified bit of ``n`` + +.. cpp:function:: int botan_mp_clear_bit(botan_mp_t n, size_t bit) + + Clears the specified bit of ``n`` + Password Hashing ---------------------------------------- |