Botan  1.10.9
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 
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
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
Definition: big_code.cpp:64
void encode(byte[], size_t) const
Definition: gmp_wrap.cpp:69
unsigned char byte
Definition: types.h:22
SecureVector< byte > to_bytes() const
Definition: gmp_wrap.h:28
GMP_MPZ(const GMP_MPZ &)
Definition: gmp_wrap.cpp:44
mpz_t value
Definition: gmp_wrap.h:22
GMP_MPZ & operator=(const GMP_MPZ &)
Definition: gmp_wrap.cpp:60
BigInt to_bigint() const
Definition: gmp_wrap.cpp:86
size_t bytes() const
Definition: gmp_wrap.cpp:78