Botan 1.10.17

gmp_wrap.h
Go to the documentation of this file.
1 /*
2 * GMP MPZ Wrapper
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_GMP_MPZ_WRAP_H__
9 #define BOTAN_GMP_MPZ_WRAP_H__
10
11 #include <botan/bigint.h>
12 #include <gmp.h>
13
14 namespace Botan {
15
16 /**
17 * Lightweight GMP mpz_t wrapper. For internal use only.
18 */
19 class GMP_MPZ
20 {
21 public:
22 mpz_t value;
23
24 BigInt to_bigint() const;
25 void encode(byte[], size_t) const;
26 size_t bytes() const;
27
28 SecureVector<byte> to_bytes() const
29 { return BigInt::encode(to_bigint()); }
30
31 GMP_MPZ& operator=(const GMP_MPZ&);
32
33 GMP_MPZ(const GMP_MPZ&);
34 GMP_MPZ(const BigInt& = 0);
35 GMP_MPZ(const byte[], size_t);
36 ~GMP_MPZ();
37 };
38
39 }
40
41 #endif
Botan::BigInt
Definition: bigint.h:22
Botan::GMP_MPZ::to_bytes
SecureVector< byte > to_bytes() const
Definition: gmp_wrap.h:28
Botan::BigInt::encode
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
Definition: big_code.cpp:64
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::GMP_MPZ::to_bigint
BigInt to_bigint() const
Definition: gmp_wrap.cpp:86
Botan::GMP_MPZ::GMP_MPZ
GMP_MPZ(const GMP_MPZ &)
Definition: gmp_wrap.cpp:44
Botan::GMP_MPZ
Definition: gmp_wrap.h:19
Botan::GMP_MPZ::~GMP_MPZ
~GMP_MPZ()
Definition: gmp_wrap.cpp:52
Botan
Definition: algo_base.h:14
Botan::GMP_MPZ::value
mpz_t value
Definition: gmp_wrap.h:22
Botan::GMP_MPZ::operator=
GMP_MPZ & operator=(const GMP_MPZ &)
Definition: gmp_wrap.cpp:60
Botan::GMP_MPZ::encode
void encode(byte[], size_t) const
Definition: gmp_wrap.cpp:69
Botan::SecureVector< byte >
Botan::GMP_MPZ::bytes
size_t bytes() const
Definition: gmp_wrap.cpp:78