bitmart 0.0.116__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bitmart/__init__.py +7 -0
- bitmart/ccxt/__init__.py +102 -0
- bitmart/ccxt/abstract/bitmart.py +117 -0
- bitmart/ccxt/async_support/__init__.py +81 -0
- bitmart/ccxt/async_support/base/__init__.py +1 -0
- bitmart/ccxt/async_support/base/exchange.py +2315 -0
- bitmart/ccxt/async_support/base/throttler.py +88 -0
- bitmart/ccxt/async_support/base/ws/__init__.py +38 -0
- bitmart/ccxt/async_support/base/ws/cache.py +219 -0
- bitmart/ccxt/async_support/base/ws/client.py +350 -0
- bitmart/ccxt/async_support/base/ws/functions.py +59 -0
- bitmart/ccxt/async_support/base/ws/future.py +46 -0
- bitmart/ccxt/async_support/base/ws/order_book.py +78 -0
- bitmart/ccxt/async_support/base/ws/order_book_side.py +174 -0
- bitmart/ccxt/async_support/bitmart.py +5361 -0
- bitmart/ccxt/base/__init__.py +27 -0
- bitmart/ccxt/base/decimal_to_precision.py +178 -0
- bitmart/ccxt/base/errors.py +273 -0
- bitmart/ccxt/base/exchange.py +7642 -0
- bitmart/ccxt/base/precise.py +297 -0
- bitmart/ccxt/base/types.py +619 -0
- bitmart/ccxt/bitmart.py +5361 -0
- bitmart/ccxt/pro/__init__.py +66 -0
- bitmart/ccxt/pro/bitmart.py +1917 -0
- bitmart/ccxt/static_dependencies/README.md +1 -0
- bitmart/ccxt/static_dependencies/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/__init__.py +6 -0
- bitmart/ccxt/static_dependencies/bip/addr/P2PKH_addr.py +205 -0
- bitmart/ccxt/static_dependencies/bip/addr/__init__.py +5 -0
- bitmart/ccxt/static_dependencies/bip/addr/addr_dec_utils.py +125 -0
- bitmart/ccxt/static_dependencies/bip/addr/addr_key_validator.py +162 -0
- bitmart/ccxt/static_dependencies/bip/addr/iaddr_decoder.py +48 -0
- bitmart/ccxt/static_dependencies/bip/addr/iaddr_encoder.py +50 -0
- bitmart/ccxt/static_dependencies/bip/base58/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/bip/base58/base58.py +207 -0
- bitmart/ccxt/static_dependencies/bip/base58/base58_ex.py +25 -0
- bitmart/ccxt/static_dependencies/bip/base58/base58_xmr.py +155 -0
- bitmart/ccxt/static_dependencies/bip/bech32/__init__.py +4 -0
- bitmart/ccxt/static_dependencies/bip/bech32/bch_bech32.py +220 -0
- bitmart/ccxt/static_dependencies/bip/bech32/bech32.py +235 -0
- bitmart/ccxt/static_dependencies/bip/bech32/bech32_base.py +246 -0
- bitmart/ccxt/static_dependencies/bip/bech32/bech32_ex.py +25 -0
- bitmart/ccxt/static_dependencies/bip/bech32/segwit_bech32.py +173 -0
- bitmart/ccxt/static_dependencies/bip/bip32/__init__.py +14 -0
- bitmart/ccxt/static_dependencies/bip/bip32/base/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/bip/bip32/base/bip32_base.py +581 -0
- bitmart/ccxt/static_dependencies/bip/bip32/base/ibip32_key_derivator.py +83 -0
- bitmart/ccxt/static_dependencies/bip/bip32/base/ibip32_mst_key_generator.py +47 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_const.py +35 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_ex.py +29 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_key_data.py +500 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_key_net_ver.py +83 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_key_ser.py +294 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_keys.py +457 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_path.py +247 -0
- bitmart/ccxt/static_dependencies/bip/bip32/bip32_utils.py +72 -0
- bitmart/ccxt/static_dependencies/bip/bip32/kholaw/__init__.py +4 -0
- bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_ed25519.py +82 -0
- bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py +118 -0
- bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py +204 -0
- bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py +119 -0
- bitmart/ccxt/static_dependencies/bip/bip32/slip10/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_key_derivator.py +200 -0
- bitmart/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_mst_key_generator.py +168 -0
- bitmart/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_secp256k1.py +82 -0
- bitmart/ccxt/static_dependencies/bip/bip44/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/bip44/bip44.py +265 -0
- bitmart/ccxt/static_dependencies/bip/bip44_base/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/bip/bip44_base/bip44_base.py +624 -0
- bitmart/ccxt/static_dependencies/bip/bip44_base/bip44_base_ex.py +25 -0
- bitmart/ccxt/static_dependencies/bip/bip44_base/bip44_keys.py +225 -0
- bitmart/ccxt/static_dependencies/bip/coin_conf/__init__.py +2 -0
- bitmart/ccxt/static_dependencies/bip/coin_conf/coin_conf.py +68 -0
- bitmart/ccxt/static_dependencies/bip/coin_conf/coins_conf.py +890 -0
- bitmart/ccxt/static_dependencies/bip/conf/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip44/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip44/bip44_coins.py +126 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip44/bip44_conf.py +1360 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip44/bip44_conf_getter.py +153 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip49/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip49/bip49_coins.py +53 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip49/bip49_conf.py +366 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip49/bip49_conf_getter.py +80 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip84/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip84/bip84_coins.py +39 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip84/bip84_conf.py +113 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip84/bip84_conf_getter.py +66 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip86/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip86/bip86_coins.py +37 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip86/bip86_conf.py +83 -0
- bitmart/ccxt/static_dependencies/bip/conf/bip86/bip86_conf_getter.py +64 -0
- bitmart/ccxt/static_dependencies/bip/conf/common/__init__.py +8 -0
- bitmart/ccxt/static_dependencies/bip/conf/common/atom_addr.py +104 -0
- bitmart/ccxt/static_dependencies/bip/conf/common/bip_bitcoin_cash_conf.py +106 -0
- bitmart/ccxt/static_dependencies/bip/conf/common/bip_coin_conf.py +217 -0
- bitmart/ccxt/static_dependencies/bip/conf/common/bip_coins.py +28 -0
- bitmart/ccxt/static_dependencies/bip/conf/common/bip_conf_const.py +30 -0
- bitmart/ccxt/static_dependencies/bip/conf/common/bip_litecoin_conf.py +121 -0
- bitmart/ccxt/static_dependencies/bip/ecc/__init__.py +42 -0
- bitmart/ccxt/static_dependencies/bip/ecc/common/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/bip/ecc/common/dummy_point.py +219 -0
- bitmart/ccxt/static_dependencies/bip/ecc/common/ikeys.py +263 -0
- bitmart/ccxt/static_dependencies/bip/ecc/common/ipoint.py +190 -0
- bitmart/ccxt/static_dependencies/bip/ecc/conf.py +28 -0
- bitmart/ccxt/static_dependencies/bip/ecc/curve/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve.py +121 -0
- bitmart/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve_getter.py +74 -0
- bitmart/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve_types.py +37 -0
- bitmart/ccxt/static_dependencies/bip/ecc/ecdsa/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/bip/ecc/ecdsa/ecdsa_keys.py +36 -0
- bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1.py +36 -0
- bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_const.py +59 -0
- bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_keys_ecdsa.py +248 -0
- bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_point_ecdsa.py +234 -0
- bitmart/ccxt/static_dependencies/bip/slip/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/bip/slip/slip173/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/slip/slip173/slip173.py +60 -0
- bitmart/ccxt/static_dependencies/bip/slip/slip32/__init__.py +4 -0
- bitmart/ccxt/static_dependencies/bip/slip/slip32/slip32.py +322 -0
- bitmart/ccxt/static_dependencies/bip/slip/slip32/slip32_key_net_ver.py +62 -0
- bitmart/ccxt/static_dependencies/bip/slip/slip44/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/slip/slip44/slip44.py +81 -0
- bitmart/ccxt/static_dependencies/bip/utils/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/bip/utils/conf/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/utils/conf/coin_names.py +59 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/__init__.py +10 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/aes_ecb.py +152 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/blake2.py +191 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/chacha20_poly1305.py +101 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/hash160.py +57 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/hmac.py +118 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/pbkdf2.py +66 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/ripemd.py +58 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/scrypt.py +66 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/sha2.py +182 -0
- bitmart/ccxt/static_dependencies/bip/utils/crypto/sha3.py +99 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/__init__.py +7 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/algo.py +108 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/base32.py +151 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/bit.py +115 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/bytes.py +200 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/data_bytes.py +181 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/integer.py +97 -0
- bitmart/ccxt/static_dependencies/bip/utils/misc/string.py +54 -0
- bitmart/ccxt/static_dependencies/bip/utils/typing/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/utils/typing/literal.py +27 -0
- bitmart/ccxt/static_dependencies/bip/wif/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/bip/wif/wif.py +144 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/amino/amino_pb2.py +31 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/base/v1beta1/coin_pb2.py +47 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/multisig/keys_pb2.py +33 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/multisig/v1beta1/multisig_pb2.py +33 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/secp256k1/keys_pb2.py +34 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/msg/v1/msg_pb2.py +27 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/tx/signing/v1beta1/signing_pb2.py +38 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/tx/v1beta1/tx_pb2.py +75 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos_proto/cosmos_pb2.py +36 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/accountplus_pb2.py +31 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/genesis_pb2.py +40 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/models_pb2.py +26 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/params_pb2.py +29 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/query_pb2.py +57 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/tx_pb2.py +51 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/block_rate_limit_config_pb2.py +37 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/clob_pair_pb2.py +41 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/equity_tier_limit_config_pb2.py +35 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/finalize_block_pb2.py +27 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/liquidations_config_pb2.py +39 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/liquidations_pb2.py +38 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/matches_pb2.py +55 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/mev_pb2.py +49 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/operation_pb2.py +32 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/order_pb2.py +86 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/order_removals_pb2.py +32 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/process_proposer_matches_events_pb2.py +42 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/query_pb2.py +124 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/streaming_pb2.py +29 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/tx_pb2.py +117 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/genesis_pb2.py +26 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/query_pb2.py +26 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/transfer_pb2.py +61 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/tx_pb2.py +37 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/asset_position_pb2.py +29 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/genesis_pb2.py +30 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/perpetual_position_pb2.py +33 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/query_pb2.py +63 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/streaming_pb2.py +31 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/subaccount_pb2.py +33 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/gogoproto/gogo_pb2.py +102 -0
- bitmart/ccxt/static_dependencies/dydx_v4_client/registry.py +38 -0
- bitmart/ccxt/static_dependencies/ecdsa/__init__.py +14 -0
- bitmart/ccxt/static_dependencies/ecdsa/_version.py +520 -0
- bitmart/ccxt/static_dependencies/ecdsa/curves.py +56 -0
- bitmart/ccxt/static_dependencies/ecdsa/der.py +221 -0
- bitmart/ccxt/static_dependencies/ecdsa/ecdsa.py +310 -0
- bitmart/ccxt/static_dependencies/ecdsa/ellipticcurve.py +1039 -0
- bitmart/ccxt/static_dependencies/ecdsa/keys.py +343 -0
- bitmart/ccxt/static_dependencies/ecdsa/numbertheory.py +531 -0
- bitmart/ccxt/static_dependencies/ecdsa/rfc6979.py +100 -0
- bitmart/ccxt/static_dependencies/ecdsa/util.py +266 -0
- bitmart/ccxt/static_dependencies/ethereum/__init__.py +7 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/__init__.py +16 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/abi.py +19 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/base.py +152 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/codec.py +217 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/constants.py +3 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/decoding.py +565 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/encoding.py +720 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/exceptions.py +139 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/grammar.py +443 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/packed.py +13 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/py.typed +0 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/registry.py +643 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/tools/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/tools/_strategies.py +230 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/utils/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/utils/numeric.py +83 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/utils/padding.py +27 -0
- bitmart/ccxt/static_dependencies/ethereum/abi/utils/string.py +19 -0
- bitmart/ccxt/static_dependencies/ethereum/account/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/ethereum/account/encode_typed_data/__init__.py +4 -0
- bitmart/ccxt/static_dependencies/ethereum/account/encode_typed_data/encoding_and_hashing.py +239 -0
- bitmart/ccxt/static_dependencies/ethereum/account/encode_typed_data/helpers.py +40 -0
- bitmart/ccxt/static_dependencies/ethereum/account/messages.py +263 -0
- bitmart/ccxt/static_dependencies/ethereum/account/py.typed +0 -0
- bitmart/ccxt/static_dependencies/ethereum/hexbytes/__init__.py +5 -0
- bitmart/ccxt/static_dependencies/ethereum/hexbytes/_utils.py +54 -0
- bitmart/ccxt/static_dependencies/ethereum/hexbytes/main.py +65 -0
- bitmart/ccxt/static_dependencies/ethereum/hexbytes/py.typed +0 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/__init__.py +63 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/abi.py +6 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/bls.py +7 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/discovery.py +5 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/encoding.py +7 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/enums.py +17 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/ethpm.py +9 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/evm.py +20 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/networks.py +1122 -0
- bitmart/ccxt/static_dependencies/ethereum/typing/py.typed +0 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/__init__.py +115 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/abi.py +72 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/address.py +171 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/applicators.py +151 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/conversions.py +190 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/currency.py +107 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/curried/__init__.py +269 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/debug.py +20 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/decorators.py +132 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/encoding.py +6 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/exceptions.py +4 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/functional.py +75 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/hexadecimal.py +74 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/humanize.py +188 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/logging.py +159 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/module_loading.py +31 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/numeric.py +43 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/py.typed +0 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/toolz.py +76 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/types.py +54 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/typing/__init__.py +18 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/typing/misc.py +14 -0
- bitmart/ccxt/static_dependencies/ethereum/utils/units.py +31 -0
- bitmart/ccxt/static_dependencies/keccak/__init__.py +3 -0
- bitmart/ccxt/static_dependencies/keccak/keccak.py +197 -0
- bitmart/ccxt/static_dependencies/lark/__init__.py +38 -0
- bitmart/ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
- bitmart/ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
- bitmart/ccxt/static_dependencies/lark/ast_utils.py +59 -0
- bitmart/ccxt/static_dependencies/lark/common.py +86 -0
- bitmart/ccxt/static_dependencies/lark/exceptions.py +292 -0
- bitmart/ccxt/static_dependencies/lark/grammar.py +130 -0
- bitmart/ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/lark/grammars/common.lark +59 -0
- bitmart/ccxt/static_dependencies/lark/grammars/lark.lark +62 -0
- bitmart/ccxt/static_dependencies/lark/grammars/python.lark +302 -0
- bitmart/ccxt/static_dependencies/lark/grammars/unicode.lark +7 -0
- bitmart/ccxt/static_dependencies/lark/indenter.py +143 -0
- bitmart/ccxt/static_dependencies/lark/lark.py +658 -0
- bitmart/ccxt/static_dependencies/lark/lexer.py +678 -0
- bitmart/ccxt/static_dependencies/lark/load_grammar.py +1428 -0
- bitmart/ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
- bitmart/ccxt/static_dependencies/lark/parser_frontends.py +257 -0
- bitmart/ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
- bitmart/ccxt/static_dependencies/lark/parsers/earley.py +314 -0
- bitmart/ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
- bitmart/ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
- bitmart/ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
- bitmart/ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
- bitmart/ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
- bitmart/ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
- bitmart/ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
- bitmart/ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
- bitmart/ccxt/static_dependencies/lark/py.typed +0 -0
- bitmart/ccxt/static_dependencies/lark/reconstruct.py +107 -0
- bitmart/ccxt/static_dependencies/lark/tools/__init__.py +70 -0
- bitmart/ccxt/static_dependencies/lark/tools/nearley.py +202 -0
- bitmart/ccxt/static_dependencies/lark/tools/serialize.py +32 -0
- bitmart/ccxt/static_dependencies/lark/tools/standalone.py +196 -0
- bitmart/ccxt/static_dependencies/lark/tree.py +267 -0
- bitmart/ccxt/static_dependencies/lark/tree_matcher.py +186 -0
- bitmart/ccxt/static_dependencies/lark/tree_templates.py +180 -0
- bitmart/ccxt/static_dependencies/lark/utils.py +343 -0
- bitmart/ccxt/static_dependencies/lark/visitors.py +596 -0
- bitmart/ccxt/static_dependencies/marshmallow/__init__.py +81 -0
- bitmart/ccxt/static_dependencies/marshmallow/base.py +65 -0
- bitmart/ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
- bitmart/ccxt/static_dependencies/marshmallow/decorators.py +231 -0
- bitmart/ccxt/static_dependencies/marshmallow/error_store.py +60 -0
- bitmart/ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
- bitmart/ccxt/static_dependencies/marshmallow/fields.py +2114 -0
- bitmart/ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
- bitmart/ccxt/static_dependencies/marshmallow/py.typed +0 -0
- bitmart/ccxt/static_dependencies/marshmallow/schema.py +1228 -0
- bitmart/ccxt/static_dependencies/marshmallow/types.py +12 -0
- bitmart/ccxt/static_dependencies/marshmallow/utils.py +378 -0
- bitmart/ccxt/static_dependencies/marshmallow/validate.py +678 -0
- bitmart/ccxt/static_dependencies/marshmallow/warnings.py +2 -0
- bitmart/ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
- bitmart/ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
- bitmart/ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
- bitmart/ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
- bitmart/ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
- bitmart/ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
- bitmart/ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
- bitmart/ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
- bitmart/ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
- bitmart/ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
- bitmart/ccxt/static_dependencies/mnemonic/__init__.py +4 -0
- bitmart/ccxt/static_dependencies/mnemonic/mnemonic.py +282 -0
- bitmart/ccxt/static_dependencies/mnemonic/py.typed +1 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/chinese_simplified.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/chinese_traditional.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/czech.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/english.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/french.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/italian.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/japanese.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/korean.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/portuguese.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/russian.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/spanish.txt +2048 -0
- bitmart/ccxt/static_dependencies/mnemonic/wordlist/turkish.txt +2048 -0
- bitmart/ccxt/static_dependencies/msgpack/__init__.py +55 -0
- bitmart/ccxt/static_dependencies/msgpack/_cmsgpack.pyx +11 -0
- bitmart/ccxt/static_dependencies/msgpack/_packer.pyx +374 -0
- bitmart/ccxt/static_dependencies/msgpack/_unpacker.pyx +547 -0
- bitmart/ccxt/static_dependencies/msgpack/buff_converter.h +8 -0
- bitmart/ccxt/static_dependencies/msgpack/exceptions.py +48 -0
- bitmart/ccxt/static_dependencies/msgpack/ext.py +168 -0
- bitmart/ccxt/static_dependencies/msgpack/fallback.py +951 -0
- bitmart/ccxt/static_dependencies/msgpack/pack.h +89 -0
- bitmart/ccxt/static_dependencies/msgpack/pack_template.h +820 -0
- bitmart/ccxt/static_dependencies/msgpack/sysdep.h +194 -0
- bitmart/ccxt/static_dependencies/msgpack/unpack.h +391 -0
- bitmart/ccxt/static_dependencies/msgpack/unpack_define.h +95 -0
- bitmart/ccxt/static_dependencies/msgpack/unpack_template.h +464 -0
- bitmart/ccxt/static_dependencies/parsimonious/__init__.py +10 -0
- bitmart/ccxt/static_dependencies/parsimonious/exceptions.py +105 -0
- bitmart/ccxt/static_dependencies/parsimonious/expressions.py +479 -0
- bitmart/ccxt/static_dependencies/parsimonious/grammar.py +487 -0
- bitmart/ccxt/static_dependencies/parsimonious/nodes.py +325 -0
- bitmart/ccxt/static_dependencies/parsimonious/utils.py +40 -0
- bitmart/ccxt/static_dependencies/starknet/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v0/__init__.py +2 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v0/model.py +44 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v0/parser.py +216 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v0/schemas.py +72 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v0/shape.py +63 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v1/__init__.py +2 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v1/core_structures.json +14 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v1/model.py +39 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v1/parser.py +220 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v1/parser_transformer.py +179 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v1/schemas.py +66 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v1/shape.py +47 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v2/__init__.py +2 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v2/model.py +89 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v2/parser.py +293 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v2/parser_transformer.py +192 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v2/schemas.py +132 -0
- bitmart/ccxt/static_dependencies/starknet/abi/v2/shape.py +107 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
- bitmart/ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
- bitmart/ccxt/static_dependencies/starknet/common.py +15 -0
- bitmart/ccxt/static_dependencies/starknet/constants.py +39 -0
- bitmart/ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/hash/address.py +79 -0
- bitmart/ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
- bitmart/ccxt/static_dependencies/starknet/hash/selector.py +16 -0
- bitmart/ccxt/static_dependencies/starknet/hash/storage.py +12 -0
- bitmart/ccxt/static_dependencies/starknet/hash/utils.py +78 -0
- bitmart/ccxt/static_dependencies/starknet/models/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
- bitmart/ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
- bitmart/ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
- bitmart/ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
- bitmart/ccxt/static_dependencies/starknet/utils/schema.py +13 -0
- bitmart/ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
- bitmart/ccxt/static_dependencies/starkware/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
- bitmart/ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
- bitmart/ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
- bitmart/ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
- bitmart/ccxt/static_dependencies/sympy/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/sympy/core/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
- bitmart/ccxt/static_dependencies/sympy/external/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
- bitmart/ccxt/static_dependencies/sympy/external/importtools.py +187 -0
- bitmart/ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
- bitmart/ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
- bitmart/ccxt/static_dependencies/toolz/__init__.py +26 -0
- bitmart/ccxt/static_dependencies/toolz/_signatures.py +784 -0
- bitmart/ccxt/static_dependencies/toolz/_version.py +520 -0
- bitmart/ccxt/static_dependencies/toolz/compatibility.py +30 -0
- bitmart/ccxt/static_dependencies/toolz/curried/__init__.py +101 -0
- bitmart/ccxt/static_dependencies/toolz/curried/exceptions.py +22 -0
- bitmart/ccxt/static_dependencies/toolz/curried/operator.py +22 -0
- bitmart/ccxt/static_dependencies/toolz/dicttoolz.py +339 -0
- bitmart/ccxt/static_dependencies/toolz/functoolz.py +1049 -0
- bitmart/ccxt/static_dependencies/toolz/itertoolz.py +1057 -0
- bitmart/ccxt/static_dependencies/toolz/recipes.py +46 -0
- bitmart/ccxt/static_dependencies/toolz/utils.py +9 -0
- bitmart/ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
- bitmart/ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
- bitmart-0.0.116.dist-info/METADATA +342 -0
- bitmart-0.0.116.dist-info/RECORD +466 -0
- bitmart-0.0.116.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
from __future__ import division
|
|
2
|
+
|
|
3
|
+
import binascii
|
|
4
|
+
import base64
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class UnexpectedDER(Exception):
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def encode_constructed(tag, value):
|
|
12
|
+
return int.to_bytes(0xa0+tag, 1, 'big') + encode_length(len(value)) + value
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def encode_integer(r):
|
|
16
|
+
assert r >= 0 # can't support negative numbers yet
|
|
17
|
+
h = ("%x" % r).encode()
|
|
18
|
+
if len(h) % 2:
|
|
19
|
+
h = b'0' + h
|
|
20
|
+
s = binascii.unhexlify(h)
|
|
21
|
+
num = s[0] if isinstance(s[0], int) else ord(s[0])
|
|
22
|
+
if num <= 0x7f:
|
|
23
|
+
return b'\x02' + int.to_bytes(len(s), 1, 'big') + s
|
|
24
|
+
else:
|
|
25
|
+
# DER integers are two's complement, so if the first byte is
|
|
26
|
+
# 0x80-0xff then we need an extra 0x00 byte to prevent it from
|
|
27
|
+
# looking negative.
|
|
28
|
+
return b'\x02' + int.to_bytes(len(s)+1, 1, 'big') + b'\x00' + s
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def encode_bitstring(s):
|
|
32
|
+
return b'\x03' + encode_length(len(s)) + s
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def encode_octet_string(s):
|
|
36
|
+
return b'\x04' + encode_length(len(s)) + s
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def encode_oid(first, second, *pieces):
|
|
40
|
+
assert first <= 2
|
|
41
|
+
assert second <= 39
|
|
42
|
+
encoded_pieces = [int.to_bytes(40*first+second, 1, 'big')] + [encode_number(p)
|
|
43
|
+
for p in pieces]
|
|
44
|
+
body = b''.join(encoded_pieces)
|
|
45
|
+
return b'\x06' + encode_length(len(body)) + body
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def encode_sequence(*encoded_pieces):
|
|
49
|
+
total_len = sum([len(p) for p in encoded_pieces])
|
|
50
|
+
return b'\x30' + encode_length(total_len) + b''.join(encoded_pieces)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def encode_number(n):
|
|
54
|
+
b128_digits = []
|
|
55
|
+
while n:
|
|
56
|
+
b128_digits.insert(0, (n & 0x7f) | 0x80)
|
|
57
|
+
n = n >> 7
|
|
58
|
+
if not b128_digits:
|
|
59
|
+
b128_digits.append(0)
|
|
60
|
+
b128_digits[-1] &= 0x7f
|
|
61
|
+
return b''.join([int.to_bytes(d, 1, 'big') for d in b128_digits])
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def remove_constructed(string):
|
|
65
|
+
s0 = string[0] if isinstance(string[0], int) else ord(string[0])
|
|
66
|
+
if (s0 & 0xe0) != 0xa0:
|
|
67
|
+
raise UnexpectedDER("wanted constructed tag (0xa0-0xbf), got 0x%02x"
|
|
68
|
+
% s0)
|
|
69
|
+
tag = s0 & 0x1f
|
|
70
|
+
length, llen = read_length(string[1:])
|
|
71
|
+
body = string[1+llen:1+llen+length]
|
|
72
|
+
rest = string[1+llen+length:]
|
|
73
|
+
return tag, body, rest
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def remove_sequence(string):
|
|
77
|
+
if not string.startswith(b'\x30'):
|
|
78
|
+
n = string[0] if isinstance(string[0], int) else ord(string[0])
|
|
79
|
+
raise UnexpectedDER("wanted sequence (0x30), got 0x%02x" % n)
|
|
80
|
+
length, lengthlength = read_length(string[1:])
|
|
81
|
+
endseq = 1+lengthlength+length
|
|
82
|
+
return string[1+lengthlength:endseq], string[endseq:]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def remove_octet_string(string):
|
|
86
|
+
if not string.startswith(b'\x04'):
|
|
87
|
+
n = string[0] if isinstance(string[0], int) else ord(string[0])
|
|
88
|
+
raise UnexpectedDER("wanted octetstring (0x04), got 0x%02x" % n)
|
|
89
|
+
length, llen = read_length(string[1:])
|
|
90
|
+
body = string[1+llen:1+llen+length]
|
|
91
|
+
rest = string[1+llen+length:]
|
|
92
|
+
return body, rest
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def remove_object(string):
|
|
96
|
+
if not string.startswith(b'\x06'):
|
|
97
|
+
n = string[0] if isinstance(string[0], int) else ord(string[0])
|
|
98
|
+
raise UnexpectedDER("wanted object (0x06), got 0x%02x" % n)
|
|
99
|
+
length, lengthlength = read_length(string[1:])
|
|
100
|
+
body = string[1+lengthlength:1+lengthlength+length]
|
|
101
|
+
rest = string[1+lengthlength+length:]
|
|
102
|
+
numbers = []
|
|
103
|
+
while body:
|
|
104
|
+
n, ll = read_number(body)
|
|
105
|
+
numbers.append(n)
|
|
106
|
+
body = body[ll:]
|
|
107
|
+
n0 = numbers.pop(0)
|
|
108
|
+
first = n0//40
|
|
109
|
+
second = n0-(40*first)
|
|
110
|
+
numbers.insert(0, first)
|
|
111
|
+
numbers.insert(1, second)
|
|
112
|
+
return tuple(numbers), rest
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def remove_integer(string):
|
|
116
|
+
if not string.startswith(b'\x02'):
|
|
117
|
+
n = string[0] if isinstance(string[0], int) else ord(string[0])
|
|
118
|
+
raise UnexpectedDER("wanted integer (0x02), got 0x%02x" % n)
|
|
119
|
+
length, llen = read_length(string[1:])
|
|
120
|
+
numberbytes = string[1+llen:1+llen+length]
|
|
121
|
+
rest = string[1+llen+length:]
|
|
122
|
+
nbytes = numberbytes[0] if isinstance(numberbytes[0], int) else ord(numberbytes[0])
|
|
123
|
+
assert nbytes < 0x80 # can't support negative numbers yet
|
|
124
|
+
return int(binascii.hexlify(numberbytes), 16), rest
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def read_number(string):
|
|
128
|
+
number = 0
|
|
129
|
+
llen = 0
|
|
130
|
+
# base-128 big endian, with b7 set in all but the last byte
|
|
131
|
+
while True:
|
|
132
|
+
if llen > len(string):
|
|
133
|
+
raise UnexpectedDER("ran out of length bytes")
|
|
134
|
+
number = number << 7
|
|
135
|
+
d = string[llen] if isinstance(string[llen], int) else ord(string[llen])
|
|
136
|
+
number += (d & 0x7f)
|
|
137
|
+
llen += 1
|
|
138
|
+
if not d & 0x80:
|
|
139
|
+
break
|
|
140
|
+
return number, llen
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def encode_length(l):
|
|
144
|
+
assert l >= 0
|
|
145
|
+
if l < 0x80:
|
|
146
|
+
return int.to_bytes(l, 1, 'big')
|
|
147
|
+
s = ("%x" % l).encode()
|
|
148
|
+
if len(s) % 2:
|
|
149
|
+
s = b'0' + s
|
|
150
|
+
s = binascii.unhexlify(s)
|
|
151
|
+
llen = len(s)
|
|
152
|
+
return int.to_bytes(0x80 | llen, 1, 'big') + s
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def read_length(string):
|
|
156
|
+
num = string[0] if isinstance(string[0], int) else ord(string[0])
|
|
157
|
+
if not (num & 0x80):
|
|
158
|
+
# short form
|
|
159
|
+
return (num & 0x7f), 1
|
|
160
|
+
# else long-form: b0&0x7f is number of additional base256 length bytes,
|
|
161
|
+
# big-endian
|
|
162
|
+
llen = num & 0x7f
|
|
163
|
+
if llen > len(string)-1:
|
|
164
|
+
raise UnexpectedDER("ran out of length bytes")
|
|
165
|
+
return int(binascii.hexlify(string[1:1+llen]), 16), 1+llen
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def remove_bitstring(string):
|
|
169
|
+
num = string[0] if isinstance(string[0], int) else ord(string[0])
|
|
170
|
+
if not string.startswith(b'\x03'):
|
|
171
|
+
raise UnexpectedDER("wanted bitstring (0x03), got 0x%02x" % num)
|
|
172
|
+
length, llen = read_length(string[1:])
|
|
173
|
+
body = string[1+llen:1+llen+length]
|
|
174
|
+
rest = string[1+llen+length:]
|
|
175
|
+
return body, rest
|
|
176
|
+
|
|
177
|
+
# SEQUENCE([1, STRING(secexp), cont[0], OBJECT(curvename), cont[1], BINTSTRING)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# signatures: (from RFC3279)
|
|
181
|
+
# ansi-X9-62 OBJECT IDENTIFIER ::= {
|
|
182
|
+
# iso(1) member-body(2) us(840) 10045 }
|
|
183
|
+
#
|
|
184
|
+
# id-ecSigType OBJECT IDENTIFIER ::= {
|
|
185
|
+
# ansi-X9-62 signatures(4) }
|
|
186
|
+
# ecdsa-with-SHA1 OBJECT IDENTIFIER ::= {
|
|
187
|
+
# id-ecSigType 1 }
|
|
188
|
+
## so 1,2,840,10045,4,1
|
|
189
|
+
## so 0x42, .. ..
|
|
190
|
+
|
|
191
|
+
# Ecdsa-Sig-Value ::= SEQUENCE {
|
|
192
|
+
# r INTEGER,
|
|
193
|
+
# s INTEGER }
|
|
194
|
+
|
|
195
|
+
# id-public-key-type OBJECT IDENTIFIER ::= { ansi-X9.62 2 }
|
|
196
|
+
#
|
|
197
|
+
# id-ecPublicKey OBJECT IDENTIFIER ::= { id-publicKeyType 1 }
|
|
198
|
+
|
|
199
|
+
# I think the secp224r1 identifier is (t=06,l=05,v=2b81040021)
|
|
200
|
+
# secp224r1 OBJECT IDENTIFIER ::= {
|
|
201
|
+
# iso(1) identified-organization(3) certicom(132) curve(0) 33 }
|
|
202
|
+
# and the secp384r1 is (t=06,l=05,v=2b81040022)
|
|
203
|
+
# secp384r1 OBJECT IDENTIFIER ::= {
|
|
204
|
+
# iso(1) identified-organization(3) certicom(132) curve(0) 34 }
|
|
205
|
+
|
|
206
|
+
def unpem(pem):
|
|
207
|
+
if isinstance(pem, str):
|
|
208
|
+
pem = pem.encode()
|
|
209
|
+
|
|
210
|
+
d = b''.join([l.strip() for l in pem.split(b'\n')
|
|
211
|
+
if l and not l.startswith(b'-----')])
|
|
212
|
+
return base64.b64decode(d)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def topem(der, name):
|
|
216
|
+
b64 = base64.b64encode(der)
|
|
217
|
+
lines = [("-----BEGIN %s-----\n" % name).encode()]
|
|
218
|
+
lines.extend([b64[start:start+64]+b'\n'
|
|
219
|
+
for start in range(0, len(b64), 64)])
|
|
220
|
+
lines.append(("-----END %s-----\n" % name).encode())
|
|
221
|
+
return b''.join(lines)
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Implementation of Elliptic-Curve Digital Signatures.
|
|
5
|
+
|
|
6
|
+
Classes and methods for elliptic-curve signatures:
|
|
7
|
+
private keys, public keys, signatures,
|
|
8
|
+
NIST prime-modulus curves with modulus lengths of
|
|
9
|
+
192, 224, 256, 384, and 521 bits.
|
|
10
|
+
|
|
11
|
+
Example:
|
|
12
|
+
|
|
13
|
+
# (In real-life applications, you would probably want to
|
|
14
|
+
# protect against defects in SystemRandom.)
|
|
15
|
+
from random import SystemRandom
|
|
16
|
+
randrange = SystemRandom().randrange
|
|
17
|
+
|
|
18
|
+
# Generate a public/private key pair using the NIST Curve P-192:
|
|
19
|
+
|
|
20
|
+
g = generator_192
|
|
21
|
+
n = g.order()
|
|
22
|
+
secret = randrange( 1, n )
|
|
23
|
+
pubkey = Public_key( g, g * secret )
|
|
24
|
+
privkey = Private_key( pubkey, secret )
|
|
25
|
+
|
|
26
|
+
# Signing a hash value:
|
|
27
|
+
|
|
28
|
+
hash = randrange( 1, n )
|
|
29
|
+
signature = privkey.sign( hash, randrange( 1, n ) )
|
|
30
|
+
|
|
31
|
+
# Verifying a signature for a hash value:
|
|
32
|
+
|
|
33
|
+
if pubkey.verifies( hash, signature ):
|
|
34
|
+
print_("Demo verification succeeded.")
|
|
35
|
+
else:
|
|
36
|
+
print_("*** Demo verification failed.")
|
|
37
|
+
|
|
38
|
+
# Verification fails if the hash value is modified:
|
|
39
|
+
|
|
40
|
+
if pubkey.verifies( hash-1, signature ):
|
|
41
|
+
print_("**** Demo verification failed to reject tampered hash.")
|
|
42
|
+
else:
|
|
43
|
+
print_("Demo verification correctly rejected tampered hash.")
|
|
44
|
+
|
|
45
|
+
Version of 2009.05.16.
|
|
46
|
+
|
|
47
|
+
Revision history:
|
|
48
|
+
2005.12.31 - Initial version.
|
|
49
|
+
2008.11.25 - Substantial revisions introducing new classes.
|
|
50
|
+
2009.05.16 - Warn against using random.randrange in real applications.
|
|
51
|
+
2009.05.17 - Use random.SystemRandom by default.
|
|
52
|
+
|
|
53
|
+
Written in 2005 by Peter Pearson and placed in the public domain.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
from . import ellipticcurve
|
|
57
|
+
from . import numbertheory
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class RSZeroError(RuntimeError):
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class Signature(object):
|
|
65
|
+
"""ECDSA signature.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
def __init__(self, r, s, recovery_param):
|
|
69
|
+
self.r = r
|
|
70
|
+
self.s = s
|
|
71
|
+
self.recovery_param = recovery_param
|
|
72
|
+
|
|
73
|
+
def recover_public_keys(self, hash, generator):
|
|
74
|
+
"""Returns two public keys for which the signature is valid
|
|
75
|
+
hash is signed hash
|
|
76
|
+
generator is the used generator of the signature
|
|
77
|
+
"""
|
|
78
|
+
curve = generator.curve()
|
|
79
|
+
n = generator.order()
|
|
80
|
+
r = self.r
|
|
81
|
+
s = self.s
|
|
82
|
+
e = hash
|
|
83
|
+
x = r
|
|
84
|
+
|
|
85
|
+
# Compute the curve point with x as x-coordinate
|
|
86
|
+
alpha = (pow(x, 3, curve.p()) + (curve.a() * x) + curve.b()) % curve.p()
|
|
87
|
+
beta = numbertheory.square_root_mod_prime(alpha, curve.p())
|
|
88
|
+
y = beta if beta % 2 == 0 else curve.p() - beta
|
|
89
|
+
|
|
90
|
+
# Compute the public key
|
|
91
|
+
R1 = ellipticcurve.Point(curve, x, y, n)
|
|
92
|
+
Q1 = numbertheory.inverse_mod(r, n) * (s * R1 + (-e % n) * generator)
|
|
93
|
+
Pk1 = Public_key(generator, Q1)
|
|
94
|
+
|
|
95
|
+
# And the second solution
|
|
96
|
+
R2 = ellipticcurve.Point(curve, x, -y, n)
|
|
97
|
+
Q2 = numbertheory.inverse_mod(r, n) * (s * R2 + (-e % n) * generator)
|
|
98
|
+
Pk2 = Public_key(generator, Q2)
|
|
99
|
+
|
|
100
|
+
return [Pk1, Pk2]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Public_key(object):
|
|
104
|
+
"""Public key for ECDSA.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
def __init__(self, generator, point):
|
|
108
|
+
"""generator is the Point that generates the group,
|
|
109
|
+
point is the Point that defines the public key.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
self.curve = generator.curve()
|
|
113
|
+
self.generator = generator
|
|
114
|
+
self.point = point
|
|
115
|
+
n = generator.order()
|
|
116
|
+
if not n:
|
|
117
|
+
raise RuntimeError("Generator point must have order.")
|
|
118
|
+
if not n * point == ellipticcurve.INFINITY:
|
|
119
|
+
raise RuntimeError("Generator point order is bad.")
|
|
120
|
+
if point.x() < 0 or n <= point.x() or point.y() < 0 or n <= point.y():
|
|
121
|
+
raise RuntimeError("Generator point has x or y out of range.")
|
|
122
|
+
|
|
123
|
+
def verifies(self, hash, signature):
|
|
124
|
+
"""Verify that signature is a valid signature of hash.
|
|
125
|
+
Return True if the signature is valid.
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
# From X9.62 J.3.1.
|
|
129
|
+
|
|
130
|
+
G = self.generator
|
|
131
|
+
n = G.order()
|
|
132
|
+
r = signature.r
|
|
133
|
+
s = signature.s
|
|
134
|
+
if r < 1 or r > n - 1:
|
|
135
|
+
return False
|
|
136
|
+
if s < 1 or s > n - 1:
|
|
137
|
+
return False
|
|
138
|
+
c = numbertheory.inverse_mod(s, n)
|
|
139
|
+
u1 = (hash * c) % n
|
|
140
|
+
u2 = (r * c) % n
|
|
141
|
+
xy = u1 * G + u2 * self.point
|
|
142
|
+
v = xy.x() % n
|
|
143
|
+
return v == r
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class Private_key(object):
|
|
147
|
+
"""Private key for ECDSA.
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
def __init__(self, public_key, secret_multiplier):
|
|
151
|
+
"""public_key is of class Public_key;
|
|
152
|
+
secret_multiplier is a large integer.
|
|
153
|
+
"""
|
|
154
|
+
|
|
155
|
+
self.public_key = public_key
|
|
156
|
+
self.secret_multiplier = secret_multiplier
|
|
157
|
+
|
|
158
|
+
def sign(self, hash, random_k):
|
|
159
|
+
"""Return a signature for the provided hash, using the provided
|
|
160
|
+
random nonce. It is absolutely vital that random_k be an unpredictable
|
|
161
|
+
number in the range [1, self.public_key.point.order()-1]. If
|
|
162
|
+
an attacker can guess random_k, he can compute our private key from a
|
|
163
|
+
single signature. Also, if an attacker knows a few high-order
|
|
164
|
+
bits (or a few low-order bits) of random_k, he can compute our private
|
|
165
|
+
key from many signatures. The generation of nonces with adequate
|
|
166
|
+
cryptographic strength is very difficult and far beyond the scope
|
|
167
|
+
of this comment.
|
|
168
|
+
|
|
169
|
+
May raise RuntimeError, in which case retrying with a new
|
|
170
|
+
random value k is in order.
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
G = self.public_key.generator
|
|
174
|
+
n = G.order()
|
|
175
|
+
k = random_k % n
|
|
176
|
+
p1 = k * G
|
|
177
|
+
r = p1.x() % n
|
|
178
|
+
if r == 0:
|
|
179
|
+
raise RSZeroError("amazingly unlucky random number r")
|
|
180
|
+
s = (numbertheory.inverse_mod(k, n) *
|
|
181
|
+
(hash + (self.secret_multiplier * r) % n)) % n
|
|
182
|
+
if s == 0:
|
|
183
|
+
raise RSZeroError("amazingly unlucky random number s")
|
|
184
|
+
recovery_param = p1.y() % 2 or (2 if p1.x() == k else 0)
|
|
185
|
+
return Signature(r, s, recovery_param)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def int_to_string(x):
|
|
189
|
+
"""Convert integer x into a string of bytes, as per X9.62."""
|
|
190
|
+
assert x >= 0
|
|
191
|
+
if x == 0:
|
|
192
|
+
return b'\0'
|
|
193
|
+
result = []
|
|
194
|
+
while x:
|
|
195
|
+
ordinal = x & 0xFF
|
|
196
|
+
result.append(int.to_bytes(ordinal, 1, 'big'))
|
|
197
|
+
x >>= 8
|
|
198
|
+
|
|
199
|
+
result.reverse()
|
|
200
|
+
return b''.join(result)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def string_to_int(s):
|
|
204
|
+
"""Convert a string of bytes into an integer, as per X9.62."""
|
|
205
|
+
result = 0
|
|
206
|
+
for c in s:
|
|
207
|
+
if not isinstance(c, int):
|
|
208
|
+
c = ord(c)
|
|
209
|
+
result = 256 * result + c
|
|
210
|
+
return result
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def digest_integer(m):
|
|
214
|
+
"""Convert an integer into a string of bytes, compute
|
|
215
|
+
its SHA-1 hash, and convert the result to an integer."""
|
|
216
|
+
#
|
|
217
|
+
# I don't expect this function to be used much. I wrote
|
|
218
|
+
# it in order to be able to duplicate the examples
|
|
219
|
+
# in ECDSAVS.
|
|
220
|
+
#
|
|
221
|
+
from hashlib import sha1
|
|
222
|
+
return string_to_int(sha1(int_to_string(m)).digest())
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def point_is_valid(generator, x, y):
|
|
226
|
+
"""Is (x,y) a valid public key based on the specified generator?"""
|
|
227
|
+
|
|
228
|
+
# These are the tests specified in X9.62.
|
|
229
|
+
|
|
230
|
+
n = generator.order()
|
|
231
|
+
curve = generator.curve()
|
|
232
|
+
if x < 0 or n <= x or y < 0 or n <= y:
|
|
233
|
+
return False
|
|
234
|
+
if not curve.contains_point(x, y):
|
|
235
|
+
return False
|
|
236
|
+
if not n * ellipticcurve.Point(curve, x, y) == ellipticcurve.INFINITY:
|
|
237
|
+
return False
|
|
238
|
+
return True
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
# NIST Curve P-192:
|
|
242
|
+
_p = 6277101735386680763835789423207666416083908700390324961279
|
|
243
|
+
_r = 6277101735386680763835789423176059013767194773182842284081
|
|
244
|
+
# s = 0x3045ae6fc8422f64ed579528d38120eae12196d5L
|
|
245
|
+
# c = 0x3099d2bbbfcb2538542dcd5fb078b6ef5f3d6fe2c745de65L
|
|
246
|
+
_b = 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1
|
|
247
|
+
_Gx = 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012
|
|
248
|
+
_Gy = 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811
|
|
249
|
+
|
|
250
|
+
curve_192 = ellipticcurve.CurveFp(_p, -3, _b)
|
|
251
|
+
generator_192 = ellipticcurve.Point(curve_192, _Gx, _Gy, _r)
|
|
252
|
+
|
|
253
|
+
# NIST Curve P-224:
|
|
254
|
+
_p = 26959946667150639794667015087019630673557916260026308143510066298881
|
|
255
|
+
_r = 26959946667150639794667015087019625940457807714424391721682722368061
|
|
256
|
+
# s = 0xbd71344799d5c7fcdc45b59fa3b9ab8f6a948bc5L
|
|
257
|
+
# c = 0x5b056c7e11dd68f40469ee7f3c7a7d74f7d121116506d031218291fbL
|
|
258
|
+
_b = 0xb4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4
|
|
259
|
+
_Gx = 0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21
|
|
260
|
+
_Gy = 0xbd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34
|
|
261
|
+
|
|
262
|
+
curve_224 = ellipticcurve.CurveFp(_p, -3, _b)
|
|
263
|
+
generator_224 = ellipticcurve.Point(curve_224, _Gx, _Gy, _r)
|
|
264
|
+
|
|
265
|
+
# NIST Curve P-256:
|
|
266
|
+
_p = 115792089210356248762697446949407573530086143415290314195533631308867097853951
|
|
267
|
+
_r = 115792089210356248762697446949407573529996955224135760342422259061068512044369
|
|
268
|
+
# s = 0xc49d360886e704936a6678e1139d26b7819f7e90L
|
|
269
|
+
# c = 0x7efba1662985be9403cb055c75d4f7e0ce8d84a9c5114abcaf3177680104fa0dL
|
|
270
|
+
_b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b
|
|
271
|
+
_Gx = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296
|
|
272
|
+
_Gy = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5
|
|
273
|
+
|
|
274
|
+
curve_256 = ellipticcurve.CurveFp(_p, -3, _b)
|
|
275
|
+
generator_256 = ellipticcurve.Point(curve_256, _Gx, _Gy, _r)
|
|
276
|
+
|
|
277
|
+
# NIST Curve P-384:
|
|
278
|
+
_p = 39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319
|
|
279
|
+
_r = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643
|
|
280
|
+
# s = 0xa335926aa319a27a1d00896a6773a4827acdac73L
|
|
281
|
+
# c = 0x79d1e655f868f02fff48dcdee14151ddb80643c1406d0ca10dfe6fc52009540a495e8042ea5f744f6e184667cc722483L
|
|
282
|
+
_b = 0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef
|
|
283
|
+
_Gx = 0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7
|
|
284
|
+
_Gy = 0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f
|
|
285
|
+
|
|
286
|
+
curve_384 = ellipticcurve.CurveFp(_p, -3, _b)
|
|
287
|
+
generator_384 = ellipticcurve.Point(curve_384, _Gx, _Gy, _r)
|
|
288
|
+
|
|
289
|
+
# NIST Curve P-521:
|
|
290
|
+
_p = 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151
|
|
291
|
+
_r = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449
|
|
292
|
+
# s = 0xd09e8800291cb85396cc6717393284aaa0da64baL
|
|
293
|
+
# c = 0x0b48bfa5f420a34949539d2bdfc264eeeeb077688e44fbf0ad8f6d0edb37bd6b533281000518e19f1b9ffbe0fe9ed8a3c2200b8f875e523868c70c1e5bf55bad637L
|
|
294
|
+
_b = 0x051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00
|
|
295
|
+
_Gx = 0xc6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66
|
|
296
|
+
_Gy = 0x11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650
|
|
297
|
+
|
|
298
|
+
curve_521 = ellipticcurve.CurveFp(_p, -3, _b)
|
|
299
|
+
generator_521 = ellipticcurve.Point(curve_521, _Gx, _Gy, _r)
|
|
300
|
+
|
|
301
|
+
# Certicom secp256-k1
|
|
302
|
+
_a = 0x0000000000000000000000000000000000000000000000000000000000000000
|
|
303
|
+
_b = 0x0000000000000000000000000000000000000000000000000000000000000007
|
|
304
|
+
_p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
|
|
305
|
+
_Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
|
|
306
|
+
_Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
|
|
307
|
+
_r = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
|
|
308
|
+
|
|
309
|
+
curve_secp256k1 = ellipticcurve.CurveFp(_p, _a, _b)
|
|
310
|
+
generator_secp256k1 = ellipticcurve.Point(curve_secp256k1, _Gx, _Gy, _r)
|