| 1 | /* |
| 2 | * Class for simple, arbitrary size unsigned integer math. |
| 3 | * Note that some method implementations might lack features that weren't required so far! |
| 4 | * |
| 5 | * Copyright (C) 2008 - Olaf Freyer |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Affero General Public License |
| 9 | * as published by the Free Software Foundation; either version 3 |
| 10 | * of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU Affero General Public License for more details. |
| 16 | */ |
| 17 | |
| 18 | #ifndef INCLUDED_BIGINT_H |
| 19 | #define INCLUDED_BIGINT_Hcxx . . $ `src/common/bigint.h:19:9`! |
| 20 | |
| 21 | #include <cstdint> |
| 22 | #include <string> |
| 23 | |
| 24 | namespace pvpgncxx . . $ pvpgn/ |
| 25 | { |
| 26 | |
| 27 | class BigIntcxx . . $ pvpgn/BigInt# |
| 28 | { |
| 29 | public: |
| 30 | BigIntcxx . . $ pvpgn/BigInt#BigInt(49f6e7a06ebc5aa8).(); |
| 31 | explicit BigIntcxx . . $ pvpgn/BigInt#BigInt(ac50b47256ae7414).(stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# input); |
| 32 | explicit BigIntcxx . . $ pvpgn/BigInt#BigInt(ed53e3bbd3fa2f69).(stdcxx . . $ std/::uint16_tcxx . . $ std/uint16_t# input); |
| 33 | explicit BigIntcxx . . $ pvpgn/BigInt#BigInt(cb2f890c2fdad230).(stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# input); |
| 34 | BigIntcxx . . $ pvpgn/BigInt#BigInt(b36b8e5b36868922).(const BigIntcxx . . $ pvpgn/BigInt#& input); |
| 35 | BigIntcxx . . $ pvpgn/BigInt#& operatorcxx . . $ pvpgn/BigInt#`operator=`(edfbb244da9a4625).=(const BigIntcxx . . $ pvpgn/BigInt#& input); |
| 36 | BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).(unsigned char const* input, int input_size, int blockSize = 1, bool bigEndian = true); |
| 37 | ~cxx . . $ pvpgn/BigInt#`~BigInt`(ced63f7c635d850d).BigIntcxx . . $ pvpgn/BigInt#() throw (); |
| 38 | bool operatorcxx . . $ pvpgn/BigInt#`operator==`(1196d6b4fe21bab6).== (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 39 | bool operatorcxx . . $ pvpgn/BigInt#`operator<`(1196d6b4fe21bab6).< (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 40 | bool operatorcxx . . $ pvpgn/BigInt#`operator>`(1196d6b4fe21bab6).> (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 41 | BigIntcxx . . $ pvpgn/BigInt# operatorcxx . . $ pvpgn/BigInt#operator+(aad5a6d0d695e555).+ (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 42 | BigIntcxx . . $ pvpgn/BigInt# operatorcxx . . $ pvpgn/BigInt#operator-(aad5a6d0d695e555).- (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 43 | BigIntcxx . . $ pvpgn/BigInt# operatorcxx . . $ pvpgn/BigInt#`operator*`(aad5a6d0d695e555).* (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 44 | BigIntcxx . . $ pvpgn/BigInt# operatorcxx . . $ pvpgn/BigInt#`operator/`(aad5a6d0d695e555)./ (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 45 | BigIntcxx . . $ pvpgn/BigInt# operatorcxx . . $ pvpgn/BigInt#`operator%`(aad5a6d0d695e555).% (const BigIntcxx . . $ pvpgn/BigInt#& right) const; |
| 46 | BigIntcxx . . $ pvpgn/BigInt# operatorcxx . . $ pvpgn/BigInt#`operator<<`(5e64dd19ad388b84).<< (int bytesToShift) const; |
| 47 | static BigIntcxx . . $ pvpgn/BigInt# randomcxx . . $ pvpgn/BigInt#random(1a9faf48955cd7cf).(int size); |
| 48 | static void statuscxx . . $ pvpgn/BigInt#status(49f6e7a06ebc5aa8).(); |
| 49 | BigIntcxx . . $ pvpgn/BigInt# powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).(const BigIntcxx . . $ pvpgn/BigInt#& exp, const BigIntcxx . . $ pvpgn/BigInt#& mod) const; |
| 50 | unsigned char* getDatacxx . . $ pvpgn/BigInt#getData(7fde0967c2cfd879).(int byteCount, int blockSize = 1, bool bigEndian = true) const; |
| 51 | void getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(unsigned char* out, int byteCount, int blockSize = 1, bool bigEndian = true) const; |
| 52 | stdcxx . . $ std/::stringcxx . . $ std/string# toHexStringcxx . . $ pvpgn/BigInt#toHexString(219584694fe2b248).() const; |
| 53 | |
| 54 | private: |
| 55 | |
| 56 | explicit BigIntcxx . . $ pvpgn/BigInt#BigInt(2c44cd906ae4e829).(stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t# input); |
| 57 | using bigint_basecxx . . $ pvpgn/BigInt#bigint_base# = stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#; |
| 58 | using bigint_extendedcxx . . $ pvpgn/BigInt#bigint_extended# = stdcxx . . $ std/::uint64_tcxx . . $ std/uint64_t#; |
| 59 | #define bigint_base_maskcxx . . $ `src/common/bigint.h:59:9`! 0xffffffff |
| 60 | #define bigint_extended_carrycxx . . $ `src/common/bigint.h:60:9`! bigint_base_maskcxx . . $ `src/common/bigint.h:59:9`!+0x01 |
| 61 | #define bigint_base_bitcountcxx . . $ `src/common/bigint.h:61:9`! (sizeof(bigint_base)*8) |
| 62 | |
| 63 | bigint_basecxx . . $ pvpgn/BigInt#bigint_base# *segmentcxx . . $ pvpgn/BigInt#segment.; |
| 64 | int segment_countcxx . . $ pvpgn/BigInt#segment_count.; |
| 65 | }; |
| 66 | |
| 67 | } |
| 68 | |
| 69 | #endif /* __BIGINT_INCLUDED__ */ |