/usr/include/bitcoin/utility/big_number.hpp is in libbitcoin-dev 2.0-2.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /*
* Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* libbitcoin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License with
* additional permissions to the one published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. For more information see LICENSE.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_BIG_NUMBER_HPP
#define LIBBITCOIN_BIG_NUMBER_HPP
#include <openssl/bn.h>
#include <bitcoin/types.hpp>
namespace libbitcoin {
class big_number;
typedef std::pair<big_number, big_number> divmod_result;
// TODO: Lots of things *should* throw on error in this class
class big_number
{
public:
big_number();
big_number(uint32_t value);
big_number(const big_number& other);
~big_number();
big_number& operator=(const big_number& other);
void set_compact(uint32_t compact);
uint32_t compact() const;
void set_data(data_chunk load_data);
data_chunk data() const;
void set_hash(hash_digest load_hash);
hash_digest hash() const;
void set_uint32(uint32_t value);
uint32_t uint32() const;
void set_int32(int32_t value);
int32_t int32() const;
// Used by script system
void set_uint64(uint64_t value);
void set_int64(int64_t value);
bool operator==(const big_number& other);
bool operator!=(const big_number& other);
bool operator<=(const big_number& other);
bool operator>=(const big_number& other);
bool operator<(const big_number& other);
bool operator>(const big_number& other);
big_number& operator+=(const big_number& other);
big_number& operator-=(const big_number& other);
big_number& operator*=(const big_number& other);
big_number& operator/=(const big_number& other);
private:
friend divmod_result divmod(const big_number& a, const big_number& b);
friend const big_number operator+(
const big_number& a, const big_number& b);
friend const big_number operator-(
const big_number& a, const big_number& b);
friend const big_number operator-(const big_number& number);
friend const big_number operator/(const big_number& a,
const big_number& b);
friend const big_number operator<<(const big_number& a,
unsigned int shift);
void initialize();
void copy(const big_number& other);
void set_uint64_impl(uint64_t value, bool is_negative);
BIGNUM bignum_;
};
const big_number operator+(const big_number& a, const big_number& b);
const big_number operator-(const big_number& a, const big_number& b);
const big_number operator-(const big_number& number);
const big_number operator/(const big_number& a, const big_number& b);
const big_number operator<<(const big_number& a, unsigned int shift);
divmod_result divmod(const big_number& a, const big_number& b);
} // namespace libbitcoin
#endif
|