]> Git Repo - secp256k1.git/blob - num_openssl.h
Comments
[secp256k1.git] / num_openssl.h
1 #ifndef _SECP256K1_NUM_OPENSSL_
2 #define _SECP256K1_NUM_OPENSSL_
3
4 #include <string>
5 #include <openssl/bn.h>
6
7 namespace secp256k1 {
8
9 class Number {
10 private:
11     BIGNUM b;
12     Number(const Number &x);
13
14     operator const BIGNUM*() const;
15     operator BIGNUM*();
16 public:
17     Number();
18     ~Number();
19     Number(const unsigned char *bin, int len);
20     void SetNumber(const Number &x);
21     Number &operator=(const Number &x);
22     void SetBytes(const unsigned char *bin, int len);
23     void GetBytes(unsigned char *bin, int len);
24     void SetInt(int x);
25     void SetModInverse(const Number &x, const Number &m);
26     void SetModMul(const Number &a, const Number &b, const Number &m);
27     void SetAdd(const Number &a1, const Number &a2);
28     void SetSub(const Number &a1, const Number &a2);
29     void SetMult(const Number &a1, const Number &a2);
30     void SetDiv(const Number &a1, const Number &a2);
31     void SetMod(const Number &a, const Number &m);
32     int Compare(const Number &a) const;
33     int GetBits() const;
34     int ShiftLowBits(int bits);
35     bool IsZero() const;
36     bool IsOdd() const;
37     bool IsNeg() const;
38     bool CheckBit(int pos) const;
39     void Negate();
40     void Shift1();
41     void Inc();
42     void SetHex(const std::string &str);
43     void SetPseudoRand(const Number &max);
44     void SplitInto(int bits, Number &low, Number &high) const;
45     std::string ToString() const;
46 };
47
48 }
49
50 #endif
This page took 0.022855 seconds and 4 git commands to generate.