NBitcoinDual Base class for all Base58 check representation of data Represent a path in the hierarchy of HD keys (BIP32) Parse a KeyPath The KeyPath formated like 10/0/2'/3 A .NET implementation of the Bitcoin Improvement Proposal - 39 (BIP39) BIP39 specification used as reference located here: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki Made by thashiznets@yahoo.com.au v1.0.1.1 I ♥ Bitcoin :) Bitcoin:1ETQjMkR1NNh4jwLuN5LxY7bMsHC9PUPSV Generate a mnemonic Constructor used by inheritence only The words to be used in the wordlist Method to determine if word exists in word list, great for auto language detection The word to check for existence Exists (true/false) Returns a string containing the word at the specified index of the wordlist Index of word to return Word The number of all the words in the wordlist Base58 representaiton of a script hash Base58 representation of a bitcoin address Detect whether the input base58 is a pubkey hash or a script hash The Base58 string to parse The expected network to which it belongs A BitcoinAddress or BitcoinScriptAddress Invalid format Take the first four bytes of SHA256(SHA256(generatedaddress)) and call it addresshash. Base58 representation of an ExtKey, within a particular network. Constructor. Creates an extended key from the Base58 representation, checking the expected network. Constructor. Creates a representation of an extended key, within the specified network. Gets whether the data is the correct expected length. Gets the extended key, converting from the Base58 representation. Gets the type of item represented by this Base58 data. Gets the script of the hash of the public key corresponing to the private key of the extended key of this Base58 item. Gets the Base58 representation, in the same network, of the neutered extended key. Gets the private key of the extended key of this Base58 item. Implicit cast from BitcoinExtKey to ExtKey. Base58 representation of an ExtPubKey, within a particular network. Constructor. Creates an extended public key from the Base58 representation, checking the expected network. Constructor. Creates a representation of an extended public key, within the specified network. Gets the extended public key, converting from the Base58 representation. Gets the type of item represented by this Base58 data. Gets the script of the hash of the public key of the extended key of this Base58 item. Implicit cast from BitcoinExtPubKey to ExtPubKey. Base58 representation of a pubkey hash and base class for the representation of a script hash Inclusive block count Exclusive block count Undo information for a CTxIn Contains the prevout's CTxOut being spent, and if this was the last output of the affected transaction, its metadata as well (coinbase or not, height, transaction version) Represent a disk block range Beginning of the range (included) End of the range (excluded) Base extension class to derive from for extending the TransactionBuilder Fee per KB Get fee for the size Size in bytes Create an immutable Network instance, and register it globally so it is queriable through Network.GetNetwork(string name) and Network.GetNetworks(). A colored transaction repository which does not save ColoredTransaction AssetId of the current amount Get absolute value of the instance Split the Money in parts without loss The number of parts (must be more than 0) The splitted money A unique Id for an asset Base58 representation of an asset id Get the certificate name from the certificate subject https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0072.mediawiki Send the payment to given address ImplicitPaymentUrl if null The PaymentACK timestamp (seconds since 1-Jan-1970 UTC) when the PaymentRequest was created. timestamp (UTC) after which the PaymentRequest should be considered invalid. plain-text (no formatting) note that should be displayed to the customer, explaining what this PaymentRequest is for. Secure (usually https) location where a Payment message (see below) may be sent to obtain a PaymentACK. Default application wide certificate service provider Instance specific certificate service provider Verify that the certificate chain is trusted and signature correct. true if the certificate chain and the signature is trusted or if PKIType == None Check if the given transaction violate the policy The transaction The previous coins Policy errors Error when not enough funds are present for verifying or building a transaction Amount of Money missing Safety check, if the FeeRate exceed this value, a policy error is raised Check the standardness of scriptPubKey Returns the script actually signed and executed Additional information needed to get the ScriptCode The executed script Represent a coin which need a redeem script to be spent (P2SH or P2WSH) Returns the hash contained in the scriptPubKey (P2SH or P2WSH) The scriptPubKey The hash of the scriptPubkey Scan the Transaction for StealthCoin given address and scan key The transaction to scan The stealth address The scan private key Thread safe class representing a chain of headers from genesis Force a new tip for the chain forking point Implements the PBKDF2 key derivation function. using System.Security.Cryptography; using CryptSharp.Utility; // Compute a 128-byte derived key using HMAC-SHA256, 1000 iterations, and a given key and salt. byte[] derivedKey = Pbkdf2.ComputeDerivedKey(new HMACSHA256(key), salt, 1000, 128); using System.IO; using System.Security.Cryptography; using CryptSharp.Utility; // Create a stream using HMAC-SHA512, 1000 iterations, and a given key and salt. Stream derivedKeyStream = new Pbkdf2(new HMACSHA512(key), salt, 1000); Creates a new PBKDF2 stream. The salt. A unique salt means a unique PBKDF2 stream, even if the original key is identical. The number of iterations to apply. Reads from the derived key stream. The number of bytes to read. Bytes from the derived key stream. Computes a derived key. The salt. A unique salt means a unique derived key, even if the original key is identical. The number of iterations to apply. The desired length of the derived key. The derived key. Closes the stream, clearing memory and disposing of the HMAC algorithm. The maximum number of bytes that can be derived is 2^32-1 times the HMAC size. The position within the derived key stream. Implements the Salsa20 hash function. Applies the Salsa20 hash function. It maps a 16 element input to an output of the same size. The number of rounds. SCrypt uses 8. The input buffer. The offset into the input buffer. The output buffer. The offset into the output buffer. Implements the SCrypt key derivation function. Computes a derived key. The key to derive from. The salt. A unique salt means a unique SCrypt stream, even if the original key is identical. The cost parameter, typically a fairly large number such as 262144. Memory usage and CPU time scale approximately linearly with this parameter. The mixing block size, typically 8. Memory usage and CPU time scale approximately linearly with this parameter. The level of parallelism, typically 1. CPU time scales approximately linearly with this parameter. The maximum number of threads to spawn to derive the key. This is limited by the value. null will use as many threads as possible. The desired length of the derived key. The derived key. The SCrypt algorithm creates a salt which it then uses as a one-iteration PBKDF2 key stream with SHA256 HMAC. This method lets you retrieve this intermediate salt. The key to derive from. The salt. A unique salt means a unique SCrypt stream, even if the original key is identical. The cost parameter, typically a fairly large number such as 262144. Memory usage and CPU time scale approximately linearly with this parameter. The mixing block size, typically 8. Memory usage and CPU time scale approximately linearly with this parameter. The level of parallelism, typically 1. CPU time scales approximately linearly with this parameter. The maximum number of threads to spawn to derive the key. This is limited by the value. null will use as many threads as possible. The effective salt. Creates a derived key stream from which a derived key can be read. The key to derive from. The salt. A unique salt means a unique scrypt stream, even if the original key is identical. The cost parameter, typically a fairly large number such as 262144. Memory usage and CPU time scale approximately linearly with this parameter. The mixing block size, typically 8. Memory usage and CPU time scale approximately linearly with this parameter. The level of parallelism, typically 1. CPU time scales approximately linearly with this parameter. The maximum number of threads to spawn to derive the key. This is limited by the value. null will use as many threads as possible. The derived key stream. What we get back from the signer are the two components of a signature, r and s. To get a flat byte stream of the type used by Bitcoin we have to encode them using DER encoding, which is just a way to pack the two components into a structure. Enforce LowS on the signature Force a new tip for the chain forking point Represent any type which represent an underlying ScriptPubKey Represent a transaction map The AddressManager, keep a set of peers discovered on the network in cache can update their actual states. Replicate AddressManager of Bitcoin Core, the Buckets and BucketPosition are not guaranteed to be coherent with Bitcoin Core Choose an address to connect to. The network address of a peer, or null if none are found Return a bunch of addresses, selected at random. Do not advertize nor discover new peers Only advertize known peers Only discover peers Advertize known peer and discover peer The AddressManagerBehavior class will respond to getaddr and register advertised nodes from addr messages to the AddressManager. The AddressManagerBehavior will also receive feedback about connection attempt and success of discovered peers to the AddressManager, so it can be used later to find valid peer faster. Broadcast a transaction on the hub The transaction to broadcast The cause of the rejection or null The Chain Behavior is responsible for keeping a ConcurrentChain up to date with the peer, it also responds to getheaders messages. Keep the chain in Sync (Default : true) Respond to getheaders messages (Default : true) Using for test, this might not be reliable Check if any past blocks announced by this peer is in the invalid blocks list, and set InvalidHeaderReceived flag accordingly True if no invalid block is received Sync the chain as headers come from the network (Default : true) Asynchronously try to sync the chain Maintain connection to a given set of nodes The PingPongBehavior is responsible for firing ping message every PingInterval and responding with pong message, and close the connection if the Ping has not been completed after TimeoutInterval. Whether the behavior send Ping and respond with Pong (Default : Both) Interval after which an unresponded Ping will result in a disconnection. (Default : 20 minutes) Interval after which a Ping message is fired after the last received Pong (Default : 2 minutes) Send a ping asynchronously A NodeFilter can intercept messages received and sent. Intercept a message before it can be processed by listeners The message The rest of the pipeline Intercept a message before it is sent to the peer The rest of the pipeline Send addr unsollicited message of the AddressFrom peer when passing to Handshaked state If true, the node will receive all incoming transactions if no bloomfilter are set Whether we reuse a 1MB buffer for deserializing messages, for limiting GC activity (Default : true) Start connecting asynchronously to remote peers Drop connection to all connected nodes Asynchronously create a new set of nodes The number of node that this behavior will try to maintain online (Default : 8) If false, the search process will do its best to connect to Node in different network group to prevent sybil attacks (Default : false) Same as Disconnect Load a bloomfilter in the peer, used by SPV clients Ask for the block hashes (inv) that happened since BlockLocators Ask for transaction, block or merkle block Ask for the mempool, followed by inv messages A merkle block received after being asked with a getdata message A getdata message for an asked hash is not found by the remote peer A transaction or block are rejected being transmitted through tx or block messages "tx" or "block" Details of the error The hash being rejected A block received after being asked with a getdata message Ask block headers that happened since BlockLocators Block headers received after a getheaders messages Ask for known peer addresses in the network An available peer address in the bitcoin network is announce (unsollicited or after a getaddr) Used for knowing if an alert is valid in past of future Announce the hash of a transaction or block When parsing, maybe Magic is already parsed Connect to a random node on the network The network to connect to The addrman used for finding peers The parameters used by the found node The already connected addresses, the new address will be select outside of existing groups Connect to a random node on the network The network to connect to The parameters used by the found node, use AddressManagerBehavior.GetAddrman for finding peers The already connected addresses, the new address will be select outside of existing groups Connect to the node of this machine Send a message to the peer asynchronously The payload to send The node has been disconnected Send a message to the peer synchronously The payload to send Payload is null The node has been disconnected, or the cancellation token has been set to canceled The negociated protocol version (minimum of supported version between MyVersion and the PeerVersion) Send addr unsollicited message of the AddressFrom peer when passing to Handshaked state Transaction options we would like Transaction options supported by the peer Transaction options we prefer and which is also supported by peer Get the chain of headers from the peer (thread safe) The highest block wanted The chain of headers Synchronize a given Chain to the tip of this node if its height is higher. (Thread safe) The chain to synchronize The location until which it synchronize Create a listener that will queue messages until diposed The listener Thrown if used on the listener's thread, as it would result in a deadlock Retrieve transactions from the mempool Cancellation token Transactions in the mempool Retrieve transactions from the mempool by ids Transaction ids to retrieve Cancellation token The transactions, if a transaction is not found, then it is not returned in the array. Add supported option to the input inventory type Inventory type (like MSG_TX) Inventory type with options (MSG_TX | MSG_WITNESS_FLAG) Emit a ping and wait the pong Latency The parameters that will be cloned and applied for each node connecting to the NodeServer Represents a transaction being sent on the network, is sent after being requested by a getdata (of Transaction or MerkleBlock) message. NODE_NETWORK means that the node is capable of serving the block chain. It is currently set by all Bitcoin Core nodes, and is unset by SPV clients or other peers that just want network services but don't provide them. NODE_GETUTXO means the node is capable of responding to the getutxo protocol request. Bitcoin Core does not support this but a patch set called Bitcoin XT does. See BIP 64 for details on how this is implemented. NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections. Bitcoin Core nodes used to support this by default, without advertising this bit, but no longer do as of protocol version 70011 (= NO_BLOOM_VERSION) Indicates that a node can be asked for blocks and transactions including witness data. Indicates a modern Bitcoin Cash node. Network protocol versioning Initial protocol version, to be increased after version/verack negotiation Disconnect from peers older than this protocol version nTime field added to CAddress, starting with this version; if possible, avoid requesting addresses nodes older than this Only request blocks from nodes outside this range of versions (START) Only request blocks from nodes outside this range of versions (END) BIP 0031, pong message, is enabled for all versions AFTER this one "mempool" command, enhanced "getdata" behavior starts with this version "reject" command ! "filter*" commands are disabled without NODE_BLOOM after and including this version ! "sendheaders" command and announcing blocks with headers starts with this version ! Version after which witness support potentially exists shord-id-based block download starts with this version Client class for the unauthenticated REST Interface Initializes a new instance of the class. The rest API endpoint Null rest API endpoint Invalid value for RestResponseFormat Gets the block. The block identifier. Given a block hash (id) returns the requested block object. blockId cannot be null. Gets the block. The block identifier. Given a block hash (id) returns the requested block object. blockId cannot be null. Gets a transaction. The transaction identifier. Given a transaction hash (id) returns the requested transaction object. txId cannot be null Gets a transaction. The transaction identifier. Given a transaction hash (id) returns the requested transaction object. txId cannot be null Gets blocks headers. The initial block identifier. how many headers to get. Given a block hash (blockId) returns as much block headers as specified. blockId cannot be null count must be greater or equal to one. Gets blocks headers. The initial block identifier. how many headers to get. Given a block hash (blockId) returns as much block headers as specified. blockId cannot be null count must be greater or equal to one. Gets the chain information. Gets unspect outputs. The out points identifiers (TxIn-N). if set to true [check mempool]. The unspent transaction outputs (UTXO) for the given outPoints. outPoints cannot be null. Use default bitcoin parameters to configure a RPCClient. The network used by the node. Must not be null. Create a new RPCClient instance username:password or the content of the .cookie file Create a new RPCClient instance username:password or the content of the .cookie file Send a command https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list Get the a whole block Get the a whole block GetTransactions only returns on txn which are not entirely spent unless you run bitcoinq with txindex=1. getrawtransaction only returns on txn which are not entirely spent unless you run bitcoinq with txindex=1. Get the estimated fee per kb for being confirmed in nblock Get the estimated fee per kb for being confirmed in nblock Get the estimated fee per kb for being confirmed in nblock The time expected, in block, before getting confirmed The estimated fee rate The Fee rate couldn't be estimated because of insufficient data from Bitcoin Core Tries to get the estimated fee per kb for being confirmed in nblock The time expected, in block, before getting confirmed The estimated fee rate or null Tries to get the estimated fee per kb for being confirmed in nblock The time expected, in block, before getting confirmed The estimated fee rate or null Get the estimated fee per kb for being confirmed in nblock The time expected, in block, before getting confirmed The estimated fee rate when fee couldn't be estimated Requires wallet support. Requires an unlocked wallet or an unencrypted wallet. A P2PKH or P2SH address to which the bitcoins should be sent The amount to spend A locally-stored (not broadcast) comment assigned to this transaction. Default is no comment A locally-stored (not broadcast) comment assigned to this transaction. Meant to be used for describing who the payment was sent to. Default is no comment The TXID of the sent transaction Requires wallet support. Requires an unlocked wallet or an unencrypted wallet. A P2PKH or P2SH address to which the bitcoins should be sent The amount to spend A locally-stored (not broadcast) comment assigned to this transaction. Default is no comment A locally-stored (not broadcast) comment assigned to this transaction. Meant to be used for describing who the payment was sent to. Default is no comment The TXID of the sent transaction Returns a list of every address assigned to a particular account. The name of the account containing the addresses to get. To get addresses from the default account, pass an empty string (""). A collection of all addresses belonging to the specified account. If the account has no addresses, the collection will be empty Returns the total amount received by the specified address in transactions with at least one (default) confirmations. It does not count coinbase transactions. The address whose transactions should be tallied. The number of bitcoins received by the address, excluding coinbase transactions. May be 0. Returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions. The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance. Transactions generated by this node are counted immediately. Typically, externally-generated transactions are payments to this wallet and transactions generated by this node are payments to other wallets. Use 0 to count unconfirmed transactions. Default is 1. The number of bitcoins received by the address, excluding coinbase transactions. May be 0. Lists accounts and their balances, with the default number of confirmations for balances (1), and not including watch only addresses (default false). Lists accounts and their balances, based on the specified number of confirmations. The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance. Transactions generated by this node are counted immediately. Typically, externally-generated transactions are payments to this wallet and transactions generated by this node are payments to other wallets. Use 0 to count unconfirmed transactions. Default is 1. A list of accounts and their balances. Lists accounts and their balances, based on the specified number of confirmations, and including watch only accounts if specified. (Added in Bitcoin Core 0.10.0) The minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance. Transactions generated by this node are counted immediately. Typically, externally-generated transactions are payments to this wallet and transactions generated by this node are payments to other wallets. Use 0 to count unconfirmed transactions. Default is 1. If set to true, include watch-only addresses in details and calculations as if they were regular addresses belonging to the wallet. If set to false (the default), treat watch-only addresses as if they didn’t belong to this wallet. A list of accounts and their balances. Returns an array of unspent transaction outputs belonging to this wallet. Note: as of Bitcoin Core 0.10.0, outputs affecting watch-only addresses will be returned; see the spendable field in the results. Returns an array of unspent transaction outputs belonging to this wallet, specifying the minimum and maximum number of confirmations to include, and the list of addresses to include. Returns an array of unspent transaction outputs belonging to this wallet. Returns an array of unspent transaction outputs belonging to this wallet, specifying the minimum and maximum number of confirmations to include, and the list of addresses to include. If this flag set, CTxIn::nSequence is NOT interpreted as a relative lock-time. If CTxIn::nSequence encodes a relative lock-time and this flag is set, the relative lock-time has units of 512 seconds, otherwise it specifies blocks with a granularity of 1. If CTxIn::nSequence encodes a relative lock-time, this mask is applied to extract that lock-time from the sequence field. Setting nSequence to this value for every input in a transaction disables nLockTime. */ If this flag set, CTxIn::nSequence is NOT interpreted as a relative lock-time. Setting the most significant bit of a sequence number disabled relative lock-time. In order to use the same number of bits to encode roughly the same wall-clock duration, and because blocks are naturally limited to occur every 600s on average, the minimum granularity for time-based relative lock-time is fixed at 512 seconds. Converting from CTxIn::nSequence to seconds is performed by multiplying by 512 = 2^9, or equivalently shifting up by 9 bits. Add an item to the collection When disposed, the item is removed Use qbitninja public servers Idempotent and thread safe for tracking operations belonging to a set of ScriptPubKeys Register the specified ScriptPubKey The destination If true, the P2SH of the destination's script will be tracked (Default: false) If true, the scriptPubKey will not belong to tracked data, typically, change addresses (Default: false) The filter in which this key will appear (http://eprint.iacr.org/2014/763.pdf) The wallet name to which it belongs Register the specified ScriptPubKey The ScriptPubKey If true, the P2SH of the destination's script will be tracked (Default: false) If true, the scriptPubKey will not belong to tracked data, typically, change addresses (Default: false) The filter in which this key will appear (http://eprint.iacr.org/2014/763.pdf) The wallet name to which it belongs Check internal consistency Load a bloom filter on the node, and push transactions in the Tracker Create a new TrackerBehavior instance The Tracker registering transactions and confirmations The chain used to fetch height of incoming blocks, if null, use the chain of ChainBehavior Start a scan, if a scan is already running, will change only if the parameters are anterior The expected false positive rate (between 1.0 and 0) The maximum accepted false positive rate difference, the node will be disconnected if the actual false positive rate is higher than FalsePositiveRate + MaximumFalsePositiveRateDifference. Refresh the bloom filter Send message once the bloom filter is set Message to send Create a P2PKH wallet with one key The master key to use A SPV Wallet respecting recommendation for privacy http://eprint.iacr.org/2014/763.pdf Get incoming transactions of the wallet, subscribers should not make any blocking call Blocks below this date will not be processed Create a new wallet Creation parameters The number of keys which will be pre-created Create a new wallet P2PKH with one key Get the KeyPath of the given scriptPubKey ScriptPubKey The key path to the scriptPubKey Configure the components of the wallet The chain to keep in sync, if not provided the whole chain will be downloaded on the network (more than 30MB) The Address Manager for speeding up peer discovery The tracker responsible for providing bloom filters Configure the components of the wallet The parameters to the connection Configure the components of the wallet The group to use Start the connection to the NodeGroup Broadcast a transaction, if the same template behavior as been used for other nodes, they will also broadcast The transaction to broadcast The cause of the rejection or null Scan the Transaction for StealthCoin given address and scan key The transaction to scan The stealth address The scan private key Scan the Transaction for StealthCoin given address and scan key The transaction to scan The stealth address The scan private key Prepare a stealth payment Ephem Key Stealth Payment Add a stealth payment to the transaction Destination transaction Money to send Ephem Key Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce values to make the block's hash satisfy proof-of-work requirements. When they solve the proof-of-work, they broadcast the block to everyone and the block is added to the block chain. The first transaction in the block is a special one that creates a new coin owned by the creator of the block. If called, GetHash becomes cached, only use if you believe the instance will not be modified after calculation. Calling it a second type invalidate the cache. Set time to consensus acceptable value Network previous block Set time to consensus acceptable value Consensus previous block Set time to consensus acceptable value The expected date Consensus previous block Set time to consensus acceptable value The expected date Network previous block Check proof of work and merkle root A BlockHeader chained with all its ancestors Check PoW and that the blocks connect correctly The network being used True if PoW is correct Compact representation of one's chain position which can be used to find forks with another chain Used by SPV client, represent the set of interesting addresses tracked by SPV client with plausible deniability A private Hierarchical Deterministic key Parses the Base58 data (checking the network if specified), checks it represents the correct type of item, and then returns the corresponding ExtKey. Gets the depth of this extended key from the root key. Gets the child number of this key (in reference to the parent). Constructor. Reconstructs an extended key from the Base58 representations of the public key and corresponding private key. Constructor. Creates an extended key from the public key and corresponding private key. The ExtPubKey has the relevant values for child number, depth, chain code, and fingerprint. Constructor. Creates an extended key from the private key, and specified values for chain code, depth, fingerprint, and child number. Constructor. Creates an extended key from the private key, with the specified value for chain code. Depth, fingerprint, and child number, will have their default values. Constructor. Creates a new extended key with a random 64 byte seed. Constructor. Creates a new extended key from the specified seed bytes, from the given hex string. Constructor. Creates a new extended key from the specified seed bytes. Get the private key of this extended key. Create the public key from this key. Derives a new extended key in the hierarchy as the given child number. Derives a new extended key in the hierarchy as the given child number, setting the high bit if hardened is specified. Derives a new extended key in the hierarchy at the given path below the current key, by deriving the specified child at each step. Converts the extended key to the base58 representation, within the specified network. Converts the extended key to the base58 representation, as a string, within the specified network. Gets the script of the hash of the public key corresponding to the private key. Gets whether or not this extended key is a hardened child. Recreates the private key of the parent from the private key of the child combinated with the public key of the parent (hardened children cannot be used to recreate the parent). A public HD key The P2PKH payment script Height in coinbase Height in OP_CLTV Strict DER signature Create a bitcoin address from base58 data, return a BitcoinAddress or BitcoinScriptAddress base58 address Invalid base58 address BitcoinScriptAddress, BitcoinAddress Find automatically the data type and the network to which belong the base58 data base58 data Invalid base58 data Get network from protocol magic number Magic number The network, or null of the magic number does not match any network Get network from name main,mainnet,testnet,test,testnet3,reg,regtest,seg,segnet The network or null of the name does not match any network Represent the challenge that miners must solve for finding a new block Algorithm implemented by bitcoin core https://github.com/bitcoin/bitcoin/blob/master/src/wallet.cpp#L1276 Minimize the change Exception thrown when not enough funds are present for verifying or building a transaction The group name who is missing the funds Amount of Money missing A class for building and signing all sort of transactions easily (http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All) Will transform transfers below Dust, so the transaction get correctly relayed by the network. A callback used by the TransactionBuilder when it does not find the coin for an input A callback used by the TransactionBuilder when it does not find the key for a scriptPubKey Set the name of this group (group are separated by call to Then()) Name of the group Send bitcoins to a destination The destination The amount Send bitcoins to a destination The destination The amount Send a money amount to the destination The destination The amount (supported : Money, AssetMoney, MoneyBag) The coin type is not supported Send a money amount to the destination The destination The amount (supported : Money, AssetMoney, MoneyBag) The coin type is not supported Send assets (Open Asset) to a destination The destination The asset and amount Send assets (Open Asset) to a destination The destination The asset and amount Set transaction policy fluently The policy this Split the estimated fees accross the several groups (separated by Then()) Estimate the fee needed for the transaction, and split among groups according to their fee weight Send the fee splitted among groups according to their fee weight If using SendFeesSplit or SendEstimatedFeesSplit, determine the weight this group participate in paying the fees The weight of fee participation Build the transaction True if signs all inputs with the available keys The transaction Not enough funds are available Build the transaction True if signs all inputs with the available keys The type of signature The transaction Not enough funds are available Verify that a transaction is fully signed and have enough fees The transaction to check True if no error Verify that a transaction is fully signed and have enough fees The transaction to check The expected fees (more or less 10%) True if no error Verify that a transaction is fully signed and have enough fees The transaction to check The expected fee rate True if no error Verify that a transaction is fully signed and have enough fees The transaction to check Detected errors True if no error Verify that a transaction is fully signed, have enough fees, and follow the Standard and Miner Transaction Policy rules The transaction to check The expected fees (more or less 10%) Detected errors True if no error Verify that a transaction is fully signed and have enough fees The transaction to check The expected fee rate Detected errors True if no error Verify that a transaction is fully signed and have enough fees he transaction to check The expected fee rate Detected errors Verify that a transaction is fully signed and have enough fees he transaction to check The expected fee Detected errors Verify that a transaction is fully signed and have enough fees he transaction to check Detected errors Find spent coins of a transaction The transaction Array of size tx.Input.Count, if a coin is not fund, a null coin is returned. Estimate the physical size of the transaction The transaction to be estimated Estimate the size of the transaction The transaction to be estimated If true, returns the size on which fee calculation are based, else returns the physical byte size Estimate fees of the built transaction Fee rate Estimate fees of an unsigned transaction Fee rate Create a new participant in the transaction with its own set of coins and keys Switch to another participant in the transaction, or create a new one if it is not found. Specify the amount of money to cover txouts, if not specified all txout will be covered Allows to keep building on the top of a partially built transaction Transaction to complete Will cover the remaining amount of TxOut of a partially built transaction (to call after ContinueToBuild) Check if valid transaction signature Signature in bytes Verification rules True if valid Check if valid transaction signature The signature Verification rules Error True if valid Enforce LowS on the signature Same than GetBitcoinSecret Get the Money corresponding to the input assetId The asset id, if null, will assume bitcoin amount Never returns null, eithers the AssetMoney or Money if assetId is null Split the MoneyBag in several one, without loss The number of parts (must be more than 0) The splitted money Parse a bitcoin amount (Culture Invariant) Parse a bitcoin amount (Culture Invariant) Get absolute value of the instance Split the Money in parts without loss The number of parts (must be more than 0) The splitted money Convert Money to decimal (same as ToDecimal) Convert Money to decimal (same as ToUnit) Returns a culture invariant string representation of Bitcoin amount Returns a culture invariant string representation of Bitcoin amount True if show + for a positive amount True if trim excess zeroes Tell if amount is almost equal to this instance more or less amount true if equals, else false Tell if amount is almost equal to this instance error margin (between 0 and 1) true if equals, else false Remove superflous branches Create a new Public key from string Create a new Public key from byte array Create a new Public key from byte array byte array If false, make internal copy of bytes and does perform only a costly check for PubKey format. If true, the bytes array is used as is and only PubKey.Check is used for validating the format. Check on public key format. bytes array If false, will only check the first byte and length of the array. If true, will also check that the ECC coordinates are correct. true if byte array is valid Verify message signed using signmessage from bitcoincore The message The signature True if signatures is valid Verify message signed using signmessage from bitcoincore The message The signature True if signatures is valid Decode signature from bitcoincore verify/signing rpc methods Exchange shared secret through ECDH Private key Shared secret Script verification flags Evaluate P2SH subscripts (softfork safe, BIP16). Passing a non-strict-DER signature or one with undefined hashtype to a checksig operation causes script failure. Passing a pubkey that is not (0x04 + 64 bytes) or (0x02 or 0x03 + 32 bytes) to checksig causes that pubkey to be + skipped (not softfork safe: this flag can widen the validity of OP_CHECKSIG OP_NOT). Passing a non-strict-DER signature to a checksig operation causes script failure (softfork safe, BIP62 rule 1) Passing a non-strict-DER signature or one with S > order/2 to a checksig operation causes script failure (softfork safe, BIP62 rule 5). verify dummy stack item consumed by CHECKMULTISIG is of zero-length (softfork safe, BIP62 rule 7). Using a non-push operator in the scriptSig causes script failure (softfork safe, BIP62 rule 2). Require minimal encodings for all push operations (OP_0... OP_16, OP_1NEGATE where possible, direct pushes up to 75 bytes, OP_PUSHDATA up to 255 bytes, OP_PUSHDATA2 for anything larger). Evaluating any other push causes the script to fail (BIP62 rule 3). In addition, whenever a stack element is interpreted as a number, it must be of minimal length (BIP62 rule 4). (softfork safe) Discourage use of NOPs reserved for upgrades (NOP1-10) Provided so that nodes can avoid accepting or mining transactions containing executed NOP's whose meaning may change after a soft-fork, thus rendering the script invalid; with this flag set executing discouraged NOPs fails the script. This verification flag will never be a mandatory flag applied to scripts in a block. NOPs that are not executed, e.g. within an unexecuted IF ENDIF block, are *not* rejected. Require that only a single stack element remains after evaluation. This changes the success criterion from "At least one stack element must remain, and when interpreted as a boolean, it must be true" to "Exactly one stack element must remain, and when interpreted as a boolean, it must be true". (softfork safe, BIP62 rule 6) Note: CLEANSTACK should never be used without P2SH. Verify CHECKLOCKTIMEVERIFY See BIP65 for details. See BIP68 for details. Support segregated witness Making v2-v16 witness program non-standard Segwit script only: Require the argument of OP_IF/NOTIF to be exactly 0x01 or empty vector Signature(s) must be empty vector if an CHECK(MULTI)SIG operation failed Public keys in segregated witness scripts must be compressed Mandatory script verification flags that all new blocks must comply with for them to be valid. (but old blocks may not comply with) Currently just P2SH, but in the future other flags may be added, such as a soft-fork to enforce strict DER encoding. Failing one of these tests may trigger a DoS ban - see CheckInputs() for details. Standard script verification flags that standard transactions will comply with. However scripts violating these flags may still be present in valid blocks and we must accept those blocks. Signature hash types/flags All outputs are signed No outputs as signed Only the output with the same index as this input is signed If set, using non-quadratic Cash signing If set, no inputs, except this, are part of the signature Script opcodes Get the P2SH scriptPubKey of this script Extract P2SH or P2PH address from scriptSig The network Extract P2SH or P2PH id from scriptSig The network Extract P2SH/P2PH/P2WSH/P2WPKH address from scriptPubKey Extract P2SH/P2PH/P2WSH/P2WPKH id from scriptPubKey Extract public keys if this script is a multi sig or pay to pub key scriptPubKey Get script byte array Get script byte array Get script byte array if false, returns a copy of the internal byte array Get script byte array if false, returns a copy of the internal byte array Returns 1 if the input nIn of the serialized transaction pointed to by txTo correctly spends the scriptPubKey pointed to by scriptPubKey under the additional constraints specified by flags. If not NULL, err will contain an error/success code for the operation Numeric opcodes (OP_1ADD, etc) are restricted to operating on 4-byte integers. The semantics are subtle, though: operands must be in the range [-2^31 +1...2^31 -1], but results may overflow (and are valid as long as they are not used in a subsequent numeric operation). CScriptNum enforces those semantics by storing results as an int64 and allowing out-of-range values to be returned as a vector of bytes but throwing an exception if arithmetic is done or the result is interpreted as an integer. ContextStack is used internally by the bitcoin script evaluator. This class contains operations not typically available in a "pure" Stack class, as example: Insert, Swap, Erase and Top (Peek w/index) Initializes a new instance of the class. Initializes a new instance of the base on another stack. This is for copy/clone. The stack. Gets the number of items in the stack. Pushes the specified item on the stack. The item to by pushed. Pops this element in top of the stack. The element in top of the stack Pops as many items as specified. The number of items to be poped Cannot remove more elements Returns the i-th element from the top of the stack. The i-th index. the i-th element from the top of the stack topIndex Swaps the specified i and j elements in the stack. The i-th index. The j-th index. i or j Inserts an item in the specified position. The position. The value. Removes the i-th item. The item position Removes items from the i-th position to the j-th position. The item position The item position Returns a copy of the internal array. A copy of the internal array Implements a reverse enumerator for the ContextStack Extract the public key or null from the script, perform quick check on pubkey The public key Extract the public key or null from the script Whether deep checks are done on public key The public key Extract witness redeem from WitScript Witscript to extract information from Expected redeem hash The witness redeem The witness script (Witness script is not serialized and deserialized at the TxIn level, but at the Transaction level) The index of this TxIn in its transaction Create a new WitnessScript Scripts If false, make a copy of the input script array Create a new WitnessScript Scripts If called, GetHash and GetWitHash become cached, only use if you believe the instance will not be modified after calculation. Calling it a second type invalidate the cache. Size of the transaction discounting the witness (Used for fee calculation) Transaction size Sign a specific coin with the given secret Secrets Coins to sign Sign a specific coin with the given secret Private keys Coins to sign Sign a specific coin with the given secret Secret Coins to sign Sign a specific coin with the given secret Private key Coins to sign Sign the transaction with a private key ScriptSigs should be filled with previous ScriptPubKeys For more complex scenario, use TransactionBuilder Sign the transaction with a private key ScriptSigs should be filled with either previous scriptPubKeys or redeem script (for P2SH) For more complex scenario, use TransactionBuilder Calculate the fee of the transaction Coins being spent Fee or null if some spent coins are missing or if spentCoins is null Calculate the fee rate of the transaction Coins being spent Fee or null if some spent coins are missing or if spentCoins is null Interpret sequence numbers as relative lock-time constraints. Use GetMedianTimePast() instead of nTime for end point timestamp. Calculates the block height and time which the transaction must be later than in order to be considered final in the context of BIP 68. It also removes from the vector of input heights any entries which did not correspond to sequence locked inputs as they do not affect the calculation. Previous Height The block being evaluated If VerifySequence is not set, returns always true SequenceLock Sequence lock of minimum SequenceLock to satisfy Calculates the block height and time which the transaction must be later than in order to be considered final in the context of BIP 68. It also removes from the vector of input heights any entries which did not correspond to sequence locked inputs as they do not affect the calculation. Previous Height The block being evaluated If VerifySequence is not set, returns always true SequenceLock Sequence lock of minimum SequenceLock to satisfy Create a transaction with the specified option only. (useful for stripping data from a transaction) Options to keep A new transaction with only the options wanted Context free transaction check The error or success of the check Converts a given DateTime into a Unix timestamp Any DateTime The given DateTime in Unix timestamp format Gets a Unix timestamp representing the current moment Parameter ignored Now expressed as a Unix timestamp a general purpose ASN.1 decoder - note: this class differs from the others in that it returns null after it has read the last object in the stream. If an ASN.1 Null is encountered a Der/BER Null object is returned. Create an ASN1InputStream where no DER object will be longer than limit. @param input stream containing ASN.1 encoded data. @param limit maximum size of a DER encoded object. Create an ASN1InputStream based on the input byte array. The length of DER objects in the stream is automatically limited to the length of the input array. @param input array containing ASN.1 encoded data. build an object given its tag and the number of bytes to construct it from. A Null object. Create a base ASN.1 object from a byte array. The byte array to parse. The base ASN.1 object represented by the byte array. If there is a problem parsing the data. Read a base ASN.1 object from a stream. The stream to parse. The base ASN.1 object represented by the byte array. If there is a problem parsing the data. @param string the octets making up the octet string. return an Asn1Sequence from the given object. @param obj the object we want converted. @exception ArgumentException if the object cannot be converted. return the object at the sequence position indicated by index. @param index the sequence number (starting at zero) of the object @return the object at the sequence position indicated by index. return an integer from the passed in object @exception ArgumentException if the object cannot be converted. in some cases positive values Get crammed into a space, that's not quite big enough... A Null object. Return true if this oid is an extension of the passed in branch, stem. @param stem the arc or branch that is a possible parent. @return true if the branch is on the passed in stem, false otherwise. The octets making up the octet string. create an empty sequence create a sequence containing one object create a sequence containing a vector of objects. return the X9ECParameters object for the named curve represented by the passed in object identifier. Null if the curve isn't present. @param oid an object identifier representing a named curve, if present. return the object identifier signified by the passed in name. Null if there is no object identifier associated with name. @return the object identifier associated with name, if present. return the named curve name represented by the given object identifier. EllipticCurve OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) certicom(132) curve(0) } ASN.1 def for Elliptic-Curve Curve structure. See X9.62, for further details. Produce an object suitable for an Asn1OutputStream.
             Curve ::= Sequence {
                 a               FieldElement,
                 b               FieldElement,
                 seed            BIT STRING      OPTIONAL
             }
            
ASN.1 def for Elliptic-Curve ECParameters structure. See X9.62, for further details. Return the ASN.1 entry representing the Curve. @return the X9Curve for the curve in these parameters. Return the ASN.1 entry representing the FieldID. @return the X9FieldID for the FieldID in these parameters. Return the ASN.1 entry representing the base point G. @return the X9ECPoint for the base point in these parameters. Produce an object suitable for an Asn1OutputStream.
             ECParameters ::= Sequence {
                 version         Integer { ecpVer1(1) } (ecpVer1),
                 fieldID         FieldID {{FieldTypes}},
                 curve           X9Curve,
                 base            X9ECPoint,
                 order           Integer,
                 cofactor        Integer OPTIONAL
             }
            
class for describing an ECPoint as a Der object. Produce an object suitable for an Asn1OutputStream.
             ECPoint ::= OCTET STRING
            

Octet string produced using ECPoint.GetEncoded().

Class for processing an ECFieldElement as a DER object. Produce an object suitable for an Asn1OutputStream.
             FieldElement ::= OCTET STRING
            

  1. if q is an odd prime then the field element is processed as an Integer and converted to an octet string according to x 9.62 4.3.1.
  2. if q is 2m then the bit string contained in the field element is converted into an octet string with the same ordering padded at the front if necessary.

ASN.1 def for Elliptic-Curve Field ID structure. See X9.62, for further details. Constructor for elliptic curves over prime fields F2. @param primeP The prime p defining the prime field. Constructor for elliptic curves over binary fields F2m. @param m The exponent m of F2m. @param k1 The integer k1 where xm + xk1 + 1 represents the reduction polynomial f(z). Constructor for elliptic curves over binary fields F2m. @param m The exponent m of F2m. @param k1 The integer k1 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k2 The integer k2 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k3 The integer k3 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z).. Produce a Der encoding of the following structure.
             FieldID ::= Sequence {
                 fieldType       FIELD-ID.&id({IOSet}),
                 parameters      FIELD-ID.&Type({IOSet}{@fieldType})
             }
            
id-dsa-with-sha1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 } X9.63 X9.42 A wrapper class that allows block ciphers to be used to process data in a piecemeal fashion. The BufferedBlockCipher outputs a block only when the buffer is full and more data is being added, or on a doFinal.

Note: in the case where the underlying cipher is either a CFB cipher or an OFB one the last block may not be a multiple of the block size.

constructor for subclasses Create a buffered block cipher without padding. @param cipher the underlying block cipher this buffering object wraps. false otherwise. initialise the cipher. @param forEncryption if true the cipher is initialised for encryption, if false for decryption. @param param the key and other data required by the cipher. @exception ArgumentException if the parameters argument is inappropriate. return the blocksize for the underlying cipher. @return the blocksize for the underlying cipher. return the size of the output buffer required for an update an input of len bytes. @param len the length of the input. @return the space required to accommodate a call to update with len bytes of input. return the size of the output buffer required for an update plus a doFinal with an input of len bytes. @param len the length of the input. @return the space required to accommodate a call to update and doFinal with len bytes of input. process a single byte, producing an output block if necessary. @param in the input byte. @param out the space for any output that might be produced. @param outOff the offset from which the output will be copied. @return the number of output bytes copied to out. @exception DataLengthException if there isn't enough space in out. @exception InvalidOperationException if the cipher isn't initialised. process an array of bytes, producing output if necessary. @param in the input byte array. @param inOff the offset at which the input data starts. @param len the number of bytes to be copied out of the input array. @param out the space for any output that might be produced. @param outOff the offset from which the output will be copied. @return the number of output bytes copied to out. @exception DataLengthException if there isn't enough space in out. @exception InvalidOperationException if the cipher isn't initialised. Process the last block in the buffer. @param out the array the block currently being held is copied into. @param outOff the offset at which the copying starts. @return the number of output bytes copied to out. @exception DataLengthException if there is insufficient space in out for the output, or the input is not block size aligned and should be. @exception InvalidOperationException if the underlying cipher is not initialised. @exception InvalidCipherTextException if padding is expected and not found. @exception DataLengthException if the input is not block size aligned. Reset the buffer and cipher. After resetting the object is in the same state as it was after the last init (if there was one). this exception is thrown if a buffer that is meant to have output copied into it turns out to be too short, or if we've been given insufficient input. In general this exception will Get thrown rather than an ArrayOutOfBounds exception. base constructor. create a DataLengthException with the given message. @param message the message to be carried with the exception. base implementation of MD4 family style digest as outlined in "Handbook of Applied Cryptography", pages 344 - 347. Base class for SHA-384 and SHA-512. Constructor for variable length word Copy constructor. We are using copy constructors in place of the object.Clone() interface as this interface is not supported by J2ME. adjust the byte counts so that byteCount2 represents the upper long (less 3 bits) word of the byte count. implementation of RipeMD see, http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html Standard constructor Copy constructor. This will copy the state of the provided message digest. reset the chaining variables to the IV values. implementation of SHA-1 as outlined in "Handbook of Applied Cryptography", pages 346 - 349. It is interesting to ponder why the, apart from the extra IV, the other difference here from MD5 is the "endianness" of the word processing! Copy constructor. This will copy the state of the provided message digest. reset the chaining variables SHA-224 as described in RFC 3874
                    block  word  digest
            SHA-1   512    32    160
            SHA-224 512    32    224
            SHA-256 512    32    256
            SHA-384 1024   64    384
            SHA-512 1024   64    512
            
Standard constructor Copy constructor. This will copy the state of the provided message digest. reset the chaining variables Draft FIPS 180-2 implementation of SHA-256. Note: As this is based on a draft this implementation is subject to change.
                     block  word  digest
             SHA-1   512    32    160
             SHA-256 512    32    256
             SHA-384 1024   64    384
             SHA-512 1024   64    512
             
Copy constructor. This will copy the state of the provided message digest. reset the chaining variables Draft FIPS 180-2 implementation of SHA-384. Note: As this is based on a draft this implementation is subject to change.
                     block  word  digest
             SHA-1   512    32    160
             SHA-256 512    32    256
             SHA-384 1024   64    384
             SHA-512 1024   64    512
             
Copy constructor. This will copy the state of the provided message digest. reset the chaining variables Draft FIPS 180-2 implementation of SHA-512. Note: As this is based on a draft this implementation is subject to change.
                     block  word  digest
             SHA-1   512    32    160
             SHA-256 512    32    256
             SHA-384 1024   64    384
             SHA-512 1024   64    512
             
Copy constructor. This will copy the state of the provided message digest. reset the chaining variables an implementation of the AES (Rijndael), from FIPS-197.

For further details see: http://csrc.nist.gov/encryption/aes/. This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at http://fp.gladman.plus.com/cryptography_technology/rijndael/ There are three levels of tradeoff of speed vs memory Because java has no preprocessor, they are written as three separate classes from which to choose The fastest uses 8Kbytes of static tables to precompute round calculations, 4 256 word tables for encryption and 4 for decryption. The middle performance version uses only one 256 word table for each, for a total of 2Kbytes, adding 12 rotate operations per round to compute the values contained in the other tables from the contents of the first. The slowest version uses no static tables at all and computes the values in each round.

This file contains the middle performance version with 2Kbytes of static tables for round precomputation.

Calculate the necessary round keys The number of calculations depends on key size and block size AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits This code is written assuming those are the only possible values default constructor - 128 bit block size. initialise an AES cipher. @param forEncryption whether or not we are for encryption. @param parameters the parameters required to set up the cipher. @exception ArgumentException if the parameters argument is inappropriate. an implementation of the AES (Rijndael)), from FIPS-197.

For further details see: http://csrc.nist.gov/encryption/aes/. This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at http://fp.gladman.plus.com/cryptography_technology/rijndael/ There are three levels of tradeoff of speed vs memory Because java has no preprocessor), they are written as three separate classes from which to choose The fastest uses 8Kbytes of static tables to precompute round calculations), 4 256 word tables for encryption and 4 for decryption. The middle performance version uses only one 256 word table for each), for a total of 2Kbytes), adding 12 rotate operations per round to compute the values contained in the other tables from the contents of the first The slowest version uses no static tables at all and computes the values in each round

This file contains the fast version with 8Kbytes of static tables for round precomputation

Calculate the necessary round keys The number of calculations depends on key size and block size AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits This code is written assuming those are the only possible values default constructor - 128 bit block size. initialise an AES cipher. @param forEncryption whether or not we are for encryption. @param parameters the parameters required to set up the cipher. @exception ArgumentException if the parameters argument is inappropriate. Base interface for a public/private key block cipher. The name of the algorithm this cipher implements. Initialise the cipher. Initialise for encryption if true, for decryption if false. The key or other data required by the cipher. The maximum size, in bytes, an input block may be. The maximum size, in bytes, an output block will be. Process a block. The input buffer. The offset into inBuf that the input block begins. The length of the input block. Input decrypts improperly. Input is too large for the cipher. Base interface for a symmetric key block cipher. The name of the algorithm this cipher implements. Initialise the cipher. Initialise for encryption if true, for decryption if false. The key or other data required by the cipher. The block size for this cipher, in bytes. Indicates whether this cipher can handle partial blocks. Process a block. The input buffer. The offset into inBuf that the input block begins. The output buffer. The offset into outBuf to write the output block. If input block is wrong size, or outBuf too small. The number of bytes processed and produced. Reset the cipher to the same state as it was after the last init (if there was one). Block cipher engines are expected to conform to this interface. The name of the algorithm this cipher implements. Initialise the cipher. If true the cipher is initialised for encryption, if false for decryption. The key and other data required by the cipher. Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one). all parameter classes implement this. interface that a message digest conforms to. return the algorithm name @return the algorithm name return the size, in bytes, of the digest produced by this message digest. @return the size, in bytes, of the digest produced by this message digest. return the size, in bytes, of the internal buffer used by this digest. @return the size, in bytes, of the internal buffer used by this digest. update the message digest with a single byte. @param inByte the input byte to be entered. update the message digest with a block of bytes. @param input the byte array containing the data. @param inOff the offset into the byte array where the data starts. @param len the length of the data. Close the digest, producing the final digest value. The doFinal call leaves the digest reset. @param output the array the digest is to be copied into. @param outOff the offset into the out array the digest is to start at. reset the digest back to it's initial state. interface for classes implementing the Digital Signature Algorithm initialise the signer for signature generation or signature verification. @param forSigning true if we are generating a signature, false otherwise. @param param key parameters for signature generation. sign the passed in message (usually the output of a hash function). @param message the message to be signed. @return two big integers representing the r and s values respectively. verify the message message against the signature values r and s. @param message the message that was supposed to have been signed. @param r the r signature value. @param s the s signature value. The base interface for implementations of message authentication codes (MACs). Initialise the MAC. @param param the key and other data required by the MAC. @exception ArgumentException if the parameters argument is inappropriate. Return the name of the algorithm the MAC implements. @return the name of the algorithm the MAC implements. Return the block size for this MAC (in bytes). @return the block size for this MAC in bytes. add a single byte to the mac for processing. @param in the byte to be processed. @exception InvalidOperationException if the MAC is not initialised. @param in the array containing the input. @param inOff the index in the array the data begins at. @param len the length of the input starting at inOff. @exception InvalidOperationException if the MAC is not initialised. @exception DataLengthException if there isn't enough data in in. Compute the final stage of the MAC writing the output to the out parameter.

doFinal leaves the MAC in the same state it was after the last init.

@param out the array the MAC is to be output to. @param outOff the offset into the out buffer the output is to start at. @exception DataLengthException if there isn't enough space in out. @exception InvalidOperationException if the MAC is not initialised.
Reset the MAC. At the end of resetting the MAC should be in the in the same state it was after the last init (if there was one). this exception is thrown whenever we find something we don't expect in a message. base constructor. create a InvalidCipherTextException with the given message. @param message the message to be carried with the exception. Return the name of the algorithm the signer implements. @return the name of the algorithm the signer implements. Initialise the signer for signing or verification. @param forSigning true if for signing, false otherwise @param param necessary parameters. update the internal digest with the byte b update the internal digest with the byte array in Generate a signature for the message we've been loaded with using the key we were initialised with. return true if the internal state represents the signature described in the passed in array. reset the internal state HMAC implementation based on RFC2104 H(K XOR opad, H(K XOR ipad, text)) Reset the mac generator. Block cipher padders are expected to conform to this interface Initialise the padder. @param param parameters, if any required. Return the name of the algorithm the cipher implements. @return the name of the algorithm the cipher implements. add the pad bytes to the passed in block, returning the number of bytes added. return the number of pad bytes present in the block. @exception InvalidCipherTextException if the padding is badly formed or invalid. A wrapper class that allows block ciphers to be used to process data in a piecemeal fashion with padding. The PaddedBufferedBlockCipher outputs a block only when the buffer is full and more data is being added, or on a doFinal (unless the current block in the buffer is a pad block). The default padding mechanism used is the one outlined in Pkcs5/Pkcs7. Create a buffered block cipher with the desired padding. @param cipher the underlying block cipher this buffering object wraps. @param padding the padding type. Create a buffered block cipher Pkcs7 padding @param cipher the underlying block cipher this buffering object wraps. initialise the cipher. @param forEncryption if true the cipher is initialised for encryption, if false for decryption. @param param the key and other data required by the cipher. @exception ArgumentException if the parameters argument is inappropriate. return the minimum size of the output buffer required for an update plus a doFinal with an input of len bytes. @param len the length of the input. @return the space required to accommodate a call to update and doFinal with len bytes of input. return the size of the output buffer required for an update an input of len bytes. @param len the length of the input. @return the space required to accommodate a call to update with len bytes of input. process a single byte, producing an output block if necessary. @param in the input byte. @param out the space for any output that might be produced. @param outOff the offset from which the output will be copied. @return the number of output bytes copied to out. @exception DataLengthException if there isn't enough space in out. @exception InvalidOperationException if the cipher isn't initialised. process an array of bytes, producing output if necessary. @param in the input byte array. @param inOff the offset at which the input data starts. @param len the number of bytes to be copied out of the input array. @param out the space for any output that might be produced. @param outOff the offset from which the output will be copied. @return the number of output bytes copied to out. @exception DataLengthException if there isn't enough space in out. @exception InvalidOperationException if the cipher isn't initialised. Process the last block in the buffer. If the buffer is currently full and padding needs to be added a call to doFinal will produce 2 * GetBlockSize() bytes. @param out the array the block currently being held is copied into. @param outOff the offset at which the copying starts. @return the number of output bytes copied to out. @exception DataLengthException if there is insufficient space in out for the output or we are decrypting and the input is not block size aligned. @exception InvalidOperationException if the underlying cipher is not initialised. @exception InvalidCipherTextException if padding is expected and not found. A padder that adds Pkcs7/Pkcs5 padding to a block. Initialise the padder. @param random - a SecureRandom if available. Return the name of the algorithm the cipher implements. @return the name of the algorithm the cipher implements. add the pad bytes to the passed in block, returning the number of bytes added. return the number of pad bytes present in the block. EC-DSA as described in X9.62 Default configuration, random K values. Configuration with an alternate, possibly deterministic calculator of K. @param kCalculator a K value calculator. Generate a signature for the given message using the key we were initialised with. For conventional DSA the message should be a SHA-1 hash of the message of interest. @param message the message that will be verified later. return true if the value r and s represent a DSA signature for the passed in message (for standard DSA the message should be a SHA-1 hash of the real message to be verified). A deterministic K calculator based on the algorithm in section 3.2 of RFC 6979. Base constructor. @param digest digest to build the HMAC on. Interface define calculators of K values for DSA/ECDSA. Return true if this calculator is deterministic, false otherwise. @return true if deterministic, otherwise false. Non-deterministic initialiser. @param n the order of the DSA group. @param random a source of randomness. Deterministic initialiser. @param n the order of the DSA group. @param d the DSA private value. @param message the message being signed. Return the next valid value of K. @return a K value. return a = a + b - b preserved. unsigned comparison on two arrays - note the arrays may start with leading zeros. return z = x / y - done in place (z value preserved, x contains the remainder) return whether or not a BigInteger is probably prime with a probability of 1 - (1/2)**certainty.

From Knuth Vol 2, pg 395.

Calculate the numbers u1, u2, and u3 such that: u1 * a + u2 * b = u3 where u3 is the greatest common divider of a and b. a and b using the extended Euclid algorithm (refer p. 323 of The Art of Computer Programming vol 2, 2nd ed). This also seems to have the side effect of calculating some form of multiplicative inverse. @param a First number to calculate gcd for @param b Second number to calculate gcd for @param u1Out the return object for the u1 value @return The greatest common divisor of a and b return w with w = x * x - w is assumed to have enough space. return x with x = y * z - x is assumed to have enough space. Calculate mQuote = -m^(-1) mod b with b = 2^32 (32 = word size) Montgomery multiplication: a = x * y * R^(-1) mod m
Based algorithm 14.36 of Handbook of Applied Cryptography.
  • m, x, y should have length n
  • a should have length (n + 1)
  • b = 2^32, R = b^n

  • The result is put in x
    NOTE: the indices of x, y, m, a different in HAC and in Java
    return x = x % y - done in place (y value preserved) do a left shift - this returns a new array. do a right shift - this does it in place. do a right shift by one - this does it in place. returns x = x - y - we assume x is >= y Class representing a simple version of a big decimal. A SimpleBigDecimal is basically a {@link java.math.BigInteger BigInteger} with a few digits on the right of the decimal point. The number of (binary) digits on the right of the decimal point is called the scale of the SimpleBigDecimal. Unlike in {@link java.math.BigDecimal BigDecimal}, the scale is not adjusted automatically, but must be set manually. All SimpleBigDecimals taking part in the same arithmetic operation must have equal scale. The result of a multiplication of two SimpleBigDecimals returns a SimpleBigDecimal with double scale. Returns a SimpleBigDecimal representing the same numerical value as value. @param value The value of the SimpleBigDecimal to be created. @param scale The scale of the SimpleBigDecimal to be created. @return The such created SimpleBigDecimal. Constructor for SimpleBigDecimal. The value of the constructed SimpleBigDecimal Equals bigInt / 2scale. @param bigInt The bigInt value parameter. @param scale The scale of the constructed SimpleBigDecimal. Class holding methods for point multiplication based on the window τ-adic nonadjacent form (WTNAF). The algorithms are based on the paper "Improved Algorithms for Arithmetic on Anomalous Binary Curves" by Jerome A. Solinas. The paper first appeared in the Proceedings of Crypto 1997. The window width of WTNAF. The standard value of 4 is slightly less than optimal for running time, but keeps space requirements for precomputation low. For typical curves, a value of 5 or 6 results in a better running time. When changing this value, the αu's must be computed differently, see e.g. "Guide to Elliptic Curve Cryptography", Darrel Hankerson, Alfred Menezes, Scott Vanstone, Springer-Verlag New York Inc., 2004, p. 121-122 24 The αu's for a=0 as an array of ZTauElements. The αu's for a=0 as an array of TNAFs. The αu's for a=1 as an array of ZTauElements. The αu's for a=1 as an array of TNAFs. Computes the norm of an element λ of Z[τ]. @param mu The parameter μ of the elliptic curve. @param lambda The element λ of Z[τ]. @return The norm of λ. Computes the norm of an element λ of R[τ], where λ = u + vτ and u and u are real numbers (elements of R). @param mu The parameter μ of the elliptic curve. @param u The real part of the element λ of R[τ]. @param v The τ-adic part of the element λ of R[τ]. @return The norm of λ. Rounds an element λ of R[τ] to an element of Z[τ], such that their difference has minimal norm. λ is given as λ = λ0 + λ1τ. @param lambda0 The component λ0. @param lambda1 The component λ1. @param mu The parameter μ of the elliptic curve. Must equal 1 or -1. @return The rounded element of Z[τ]. @throws ArgumentException if lambda0 and lambda1 do not have same scale. Approximate division by n. For an integer k, the value λ = s k / n is computed to c bits of accuracy. @param k The parameter k. @param s The curve parameter s0 or s1. @param vm The Lucas Sequence element Vm. @param a The parameter a of the elliptic curve. @param m The bit length of the finite field Fm. @param c The number of bits of accuracy, i.e. the scale of the returned SimpleBigDecimal. @return The value λ = s k / n computed to c bits of accuracy. Computes the τ-adic NAF (non-adjacent form) of an element λ of Z[τ]. @param mu The parameter μ of the elliptic curve. @param lambda The element λ of Z[τ]. @return The τ-adic NAF of λ. Applies the operation τ() to an AbstractF2mPoint. @param p The AbstractF2mPoint to which τ() is applied. @return τ(p) Returns the parameter μ of the elliptic curve. @param curve The elliptic curve from which to obtain μ. The curve must be a Koblitz curve, i.e. a Equals 0 or 1 and b Equals 1. @return μ of the elliptic curve. @throws ArgumentException if the given ECCurve is not a Koblitz curve. Calculates the Lucas Sequence elements Uk-1 and Uk or Vk-1 and Vk. @param mu The parameter μ of the elliptic curve. @param k The index of the second element of the Lucas Sequence to be returned. @param doV If set to true, computes Vk-1 and Vk, otherwise Uk-1 and Uk. @return An array with 2 elements, containing Uk-1 and Uk or Vk-1 and Vk. Computes the auxiliary value tw. If the width is 4, then for mu = 1, tw = 6 and for mu = -1, tw = 10 @param mu The parameter μ of the elliptic curve. @param w The window width of the WTNAF. @return the auxiliary value tw Computes the auxiliary values s0 and s1 used for partial modular reduction. @param curve The elliptic curve for which to compute s0 and s1. @throws ArgumentException if curve is not a Koblitz curve (Anomalous Binary Curve, ABC). Partial modular reduction modulo (τm - 1)/(τ - 1). @param k The integer to be reduced. @param m The bitlength of the underlying finite field. @param a The parameter a of the elliptic curve. @param s The auxiliary values s0 and s1. @param mu The parameter μ of the elliptic curve. @param c The precision (number of bits of accuracy) of the partial modular reduction. @return ρ := k partmod (τm - 1)/(τ - 1) Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint} by a BigInteger using the reduced τ-adic NAF (RTNAF) method. @param p The AbstractF2mPoint to Multiply. @param k The BigInteger by which to Multiply p. @return k * p Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint} by an element λ of Z[τ] using the τ-adic NAF (TNAF) method. @param p The AbstractF2mPoint to Multiply. @param lambda The element λ of Z[τ]. @return λ * p Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint} by an element λ of Z[τ] using the τ-adic NAF (TNAF) method, given the TNAF of λ. @param p The AbstractF2mPoint to Multiply. @param u The the TNAF of λ.. @return λ * p Computes the [τ]-adic window NAF of an element λ of Z[τ]. @param mu The parameter μ of the elliptic curve. @param lambda The element λ of Z[τ] of which to compute the [τ]-adic NAF. @param width The window width of the resulting WNAF. @param pow2w 2width. @param tw The auxiliary value tw. @param alpha The αu's for the window width. @return The [τ]-adic window NAF of λ. Does the precomputation for WTNAF multiplication. @param p The ECPoint for which to do the precomputation. @param a The parameter a of the elliptic curve. @return The precomputation array for p. Class representing an element of Z[τ]. Let λ be an element of Z[τ]. Then λ is given as λ = u + vτ. The components u and v may be used directly, there are no accessor methods. Immutable class. The "real" part of λ. The "τ-adic" part of λ. Constructor for an element λ of Z[τ]. @param u The "real" part of λ. @param v The "τ-adic" part of λ. return a sqrt root - the routine verifies that the calculation returns the right value - if none exists it returns null. Create a point which encodes with point compression. @param curve the curve to use @param x affine x co-ordinate @param y affine y co-ordinate @deprecated Use ECCurve.createPoint to construct points Create a point that encodes with or without point compresion. @param curve the curve to use @param x affine x co-ordinate @param y affine y co-ordinate @param withCompression if true encode with point compression @deprecated per-point compression property will be removed, refer {@link #getEncoded(bool)} Simple shift-and-add multiplication. Serves as reference implementation to verify (possibly faster) implementations, and for very small scalars. @param p The point to multiply. @param k The multiplier. @return The result of the point multiplication kP. Base class for an elliptic curve. Adds PreCompInfo for a point on this curve, under a given name. Used by ECMultipliers to save the precomputation for this ECPoint for use by subsequent multiplication. @param point The ECPoint to store precomputations for. @param name A String used to index precomputations of different types. @param preCompInfo The values precomputed by the ECMultiplier. Normalization ensures that any projective coordinate is 1, and therefore that the x, y coordinates reflect those of the equivalent point in an affine coordinate system. Where more than one point is to be normalized, this method will generally be more efficient than normalizing each point separately. @param points An array of points that will be updated in place with their normalized versions, where necessary Normalization ensures that any projective coordinate is 1, and therefore that the x, y coordinates reflect those of the equivalent point in an affine coordinate system. Where more than one point is to be normalized, this method will generally be more efficient than normalizing each point separately. An (optional) z-scaling factor can be applied; effectively each z coordinate is scaled by this value prior to normalization (but only one actual multiplication is needed). @param points An array of points that will be updated in place with their normalized versions, where necessary @param off The start of the range of points to normalize @param len The length of the range of points to normalize @param iso The (optional) z-scaling factor - can be null Sets the default ECMultiplier, unless already set. Decode a point on this curve from its ASN.1 encoding. The different encodings are taken account of, including point compression for Fp (X9.62 s 4.2.1 pg 17). @return The decoded point. Elliptic curve over Fp The auxiliary values s0 and s1 used for partial modular reduction for Koblitz curves. Solves a quadratic equation z2 + z = beta(X9.62 D.1.6) The other solution is z + 1. @param beta The value to solve the qradratic equation for. @return the solution for z2 + z = beta or null if no solution exists. @return the auxiliary values s0 and s1 used for partial modular reduction for Koblitz curves. Returns true if this is a Koblitz curve (ABC curve). @return true if this is a Koblitz curve (ABC curve), false otherwise Elliptic curves over F2m. The Weierstrass equation is given by y2 + xy = x3 + ax2 + b. The exponent m of F2m. TPB: The integer k where xm + xk + 1 represents the reduction polynomial f(z).
    PPB: The integer k1 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z).
    TPB: Always set to 0
    PPB: The integer k2 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z).
    TPB: Always set to 0
    PPB: The integer k3 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z).
    The point at infinity on this curve. Constructor for Trinomial Polynomial Basis (TPB). @param m The exponent m of F2m. @param k The integer k where xm + xk + 1 represents the reduction polynomial f(z). @param a The coefficient a in the Weierstrass equation for non-supersingular elliptic curves over F2m. @param b The coefficient b in the Weierstrass equation for non-supersingular elliptic curves over F2m. Constructor for Trinomial Polynomial Basis (TPB). @param m The exponent m of F2m. @param k The integer k where xm + xk + 1 represents the reduction polynomial f(z). @param a The coefficient a in the Weierstrass equation for non-supersingular elliptic curves over F2m. @param b The coefficient b in the Weierstrass equation for non-supersingular elliptic curves over F2m. @param order The order of the main subgroup of the elliptic curve. @param cofactor The cofactor of the elliptic curve, i.e. #Ea(F2m) = h * n. Constructor for Pentanomial Polynomial Basis (PPB). @param m The exponent m of F2m. @param k1 The integer k1 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k2 The integer k2 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k3 The integer k3 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param a The coefficient a in the Weierstrass equation for non-supersingular elliptic curves over F2m. @param b The coefficient b in the Weierstrass equation for non-supersingular elliptic curves over F2m. Constructor for Pentanomial Polynomial Basis (PPB). @param m The exponent m of F2m. @param k1 The integer k1 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k2 The integer k2 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k3 The integer k3 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param a The coefficient a in the Weierstrass equation for non-supersingular elliptic curves over F2m. @param b The coefficient b in the Weierstrass equation for non-supersingular elliptic curves over F2m. @param order The order of the main subgroup of the elliptic curve. @param cofactor The cofactor of the elliptic curve, i.e. #Ea(F2m) = h * n. Return true if curve uses a Trinomial basis. @return true if curve Trinomial, false otherwise. return the field name for this field. @return the string "Fp". return a sqrt root - the routine verifies that the calculation returns the right value - if none exists it returns null. Class representing the Elements of the finite field F2m in polynomial basis (PB) representation. Both trinomial (Tpb) and pentanomial (Ppb) polynomial basis representations are supported. Gaussian normal basis (GNB) representation is not supported. Indicates gaussian normal basis representation (GNB). Number chosen according to X9.62. GNB is not implemented at present. Indicates trinomial basis representation (Tpb). Number chosen according to X9.62. Indicates pentanomial basis representation (Ppb). Number chosen according to X9.62. Tpb or Ppb. The exponent m of F2m. The LongArray holding the bits. Constructor for Ppb. @param m The exponent m of F2m. @param k1 The integer k1 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k2 The integer k2 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param k3 The integer k3 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z). @param x The BigInteger representing the value of the field element. Constructor for Tpb. @param m The exponent m of F2m. @param k The integer k where xm + xk + 1 represents the reduction polynomial f(z). @param x The BigInteger representing the value of the field element. Checks, if the ECFieldElements a and b are elements of the same field F2m (having the same representation). @param a field element. @param b field element to be compared. @throws ArgumentException if a and b are not elements of the same field F2m (having the same representation). @return the representation of the field F2m, either of {@link F2mFieldElement.Tpb} (trinomial basis representation) or {@link F2mFieldElement.Ppb} (pentanomial basis representation). @return the degree m of the reduction polynomial f(z). @return Tpb: The integer k where xm + xk + 1 represents the reduction polynomial f(z).
    Ppb: The integer k1 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z).
    @return Tpb: Always returns 0
    Ppb: The integer k2 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z).
    @return Tpb: Always set to 0
    Ppb: The integer k3 where xm + xk3 + xk2 + xk1 + 1 represents the reduction polynomial f(z).
    base class for points on elliptic curves. Normalizes this point, and then returns the affine x-coordinate. Note: normalization can be expensive, this method is deprecated in favour of caller-controlled normalization. Normalizes this point, and then returns the affine y-coordinate. Note: normalization can be expensive, this method is deprecated in favour of caller-controlled normalization. Returns the affine x-coordinate after checking that this point is normalized. @return The affine x-coordinate of this point @throws IllegalStateException if the point is not normalized Returns the affine y-coordinate after checking that this point is normalized @return The affine y-coordinate of this point @throws IllegalStateException if the point is not normalized Returns the x-coordinate. Caution: depending on the curve's coordinate system, this may not be the same value as in an affine coordinate system; use Normalize() to get a point where the coordinates have their affine values, or use AffineXCoord if you expect the point to already have been normalized. @return the x-coordinate of this point Returns the y-coordinate. Caution: depending on the curve's coordinate system, this may not be the same value as in an affine coordinate system; use Normalize() to get a point where the coordinates have their affine values, or use AffineYCoord if you expect the point to already have been normalized. @return the y-coordinate of this point Normalization ensures that any projective coordinate is 1, and therefore that the x, y coordinates reflect those of the equivalent point in an affine coordinate system. @return a new ECPoint instance representing the same point, but with normalized coordinates return the field element encoded with point compression. (S 4.3.6) Multiplies this ECPoint by the given number. @param k The multiplicator. @return k * this. Elliptic curve points over Fp Create a point which encodes without point compression. @param curve the curve to use @param x affine x co-ordinate @param y affine y co-ordinate Create a point that encodes with or without point compression. @param curve the curve to use @param x affine x co-ordinate @param y affine y co-ordinate @param withCompression if true encode with point compression Elliptic curve points over F2m @param curve base curve @param x x point @param y y point @param curve base curve @param x x point @param y y point @param withCompression true if encode with point compression. Constructor for point at infinity Joye's double-add algorithm. Interface for classes encapsulating a point multiplication algorithm for ECPoints. Multiplies the ECPoint p by k, i.e. p is added k times to itself. @param p The ECPoint to be multiplied. @param k The factor by which p is multiplied. @return p multiplied by k. Class holding precomputation data for fixed-point multiplications. Array holding the precomputed ECPoints used for a fixed point multiplication. The width used for the precomputation. If a larger width precomputation is already available this may be larger than was requested, so calling code should refer to the actual width. Interface for classes storing precomputation data for multiplication algorithms. Used as a Memento (see GOF patterns) for WNafMultiplier. Class implementing the WNAF (Window Non-Adjacent Form) multiplication algorithm. Multiplies this by an integer k using the Window NAF method. @param k The integer by which this is multiplied. @return A new ECPoint which equals this multiplied by k. Determine window width to use for a scalar multiplication of the given size. @param bits the bit-length of the scalar to multiply by @return the window size to use Class holding precomputation data for the WNAF (Window Non-Adjacent Form) algorithm. Array holding the precomputed ECPoints used for a Window NAF multiplication. Array holding the negations of the precomputed ECPoints used for a Window NAF multiplication. Holds an ECPoint representing Twice(this). Used for the Window NAF multiplication to create or extend the precomputed values. Computes the Window NAF (non-adjacent Form) of an integer. @param width The width w of the Window NAF. The width is defined as the minimal number w, such that for any w consecutive digits in the resulting representation, at most one is non-zero. @param k The integer of which the Window NAF is computed. @return The Window NAF of the given width, such that the following holds: k = ∑i=0l-1 ki2i , where the ki denote the elements of the returned byte[]. Determine window width to use for a scalar multiplication of the given size. @param bits the bit-length of the scalar to multiply by @return the window size to use Determine window width to use for a scalar multiplication of the given size. @param bits the bit-length of the scalar to multiply by @param windowSizeCutoffs a monotonically increasing list of bit sizes at which to increment the window width @return the window size to use Class implementing the WTNAF (Window τ-adic Non-Adjacent Form) algorithm. Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint} by k using the reduced τ-adic NAF (RTNAF) method. @param p The AbstractF2mPoint to multiply. @param k The integer by which to multiply k. @return p multiplied by k. Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint} by an element λ of Z[τ] using the τ-adic NAF (TNAF) method. @param p The AbstractF2mPoint to multiply. @param lambda The element λ of Z[τ] of which to compute the [τ]-adic NAF. @return p multiplied by λ. Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint} by an element λ of Z[τ] using the window τ-adic NAF (TNAF) method, given the WTNAF of λ. @param p The AbstractF2mPoint to multiply. @param u The the WTNAF of λ.. @return λ * p Class holding precomputation data for the WTNAF (Window τ-adic Non-Adjacent Form) algorithm. Array holding the precomputed AbstractF2mPoints used for the WTNAF multiplication in {@link NBitcoin.BouncyCastle.math.ec.multiplier.WTauNafMultiplier.multiply() WTauNafMultiplier.multiply()}. General array utilities. Are two arrays equal. Left side. Right side. True if equal. A constant time equals comparison - does not terminate early if test will fail. first array second array true if arrays equal, false otherwise. Make a copy of a range of bytes from the passed in data array. The range can extend beyond the end of the input array, in which case the return array will be padded with zeroes. @param data the array from which the data is to be copied. @param from the start index at which the copying should take place. @param to the final index of the range (exclusive). @return a new byte array containing the range given. BigInteger utilities. Return the passed in value as an unsigned byte array. @param value value to be converted. @return a byte array without a leading zero byte if present in the signed encoding. Return the passed in value as an unsigned byte array of specified length, zero-extended as necessary. @param length desired length of result array. @param n value to be converted. @return a byte array of specified length, with leading zeroes as necessary given the size of n. Return a random BigInteger not less than 'min' and not greater than 'max' @param min the least value that may be generated @param max the greatest value that may be generated @param random the source of randomness @return a random BigInteger value in the range [min,max] Class to decode and encode Hex. encode the input data producing a Hex encoded byte array. @return a byte array containing the Hex encoded data. encode the input data producing a Hex encoded byte array. @return a byte array containing the Hex encoded data. Hex encode the byte data writing it to the given output stream. @return the number of bytes produced. Hex encode the byte data writing it to the given output stream. @return the number of bytes produced. decode the Hex encoded input data. It is assumed the input data is valid. @return a byte array representing the decoded data. decode the Hex encoded string data - whitespace will be ignored. @return a byte array representing the decoded data. decode the Hex encoded string data writing it to the given output stream, whitespace characters will be ignored. @return the number of bytes produced. encode the input data producing a Hex output stream. @return the number of bytes produced. decode the Hex encoded byte data writing it to the given output stream, whitespace characters will be ignored. @return the number of bytes produced. decode the Hex encoded string data writing it to the given output stream, whitespace characters will be ignored. @return the number of bytes produced. Encode and decode byte arrays (typically from binary to 7-bit ASCII encodings). Produce a copy of this object with its configuration and in its current state. The returned object may be used simply to store the state, or may be used as a similar object starting from the copied state. Restore a copied object state into this object. Implementations of this method should try to avoid or minimise memory allocation to perform the reset. an object originally {@link #copy() copied} from an object of the same type as this instance. if the provided object is not of the correct type. Pipe all bytes from inStr to outStr, throwing StreamFlowException if greater than limit bytes in inStr. A A A The number of bytes actually transferred, if not greater than limit