The cryptographic primitives (ECDSA and HMAC) implementations in this package have been reviewed by the BitPay engineering team. More audits and reviews are welcomed.

The `bitcore.crypto.Random`

namespace contains a single function, named `getRandomBuffer(size)`

that returns a `Buffer`

instance with random bytes. It may not work depending on the engine that bitcore is running on (doesn't work with IE versions lesser than 11).

The `bitcore.Crypto.BN`

class contains a wrapper around bn.js, the bignum library used internally in bitcore.

The `bitcore.Crypto.Point`

class contains a wrapper around the class Point of elliptic.js, the elliptic curve library used internally in bitcore.

The `bitcore.Crypto.Hash`

namespace contains a set of hashes and utilities. These are either the native `crypto`

hash functions from `node.js`

or their respective browser shims as provided by the `browserify`

library.

`bitcore.Crypto.ECDSA`

contains a pure JavaScript implementation of the elliptic curve DSA signature scheme based on elliptic.js.

`elliptic.curve.point`

**Kind**: global class**Extends:** `elliptic.curve.point`

**Link**: https://github.com/indutny/elliptic

- Point ⇐
`elliptic.curve.point`

- new Point(x, y)
*instance*- .getX() ⇒
`BN`

- .getY() ⇒
`BN`

- .validate(An) ⇒
`Point`

- .getX() ⇒
*static*- .fromX(odd, x) ⇒
`Point`

- .getG() ⇒
`Point`

- .getN() ⇒
`BN`

- .fromX(odd, x) ⇒

Instantiate a valid secp256k1 Point from the X and Y coordinates.

**Returns**: `Point`

- An instance of Point**Throws**:

`Error`

A validation error if exists

Param | Type | Description |
---|---|---|

x | `BN` | `String` |
The X coordinate |

y | `BN` | `String` |
The Y coordinate |

`BN`

Will return the X coordinate of the Point

**Kind**: instance method of `Point`

**Returns**: `BN`

- A BN instance of the X coordinate

`BN`

Will return the Y coordinate of the Point

**Kind**: instance method of `Point`

**Returns**: `BN`

- A BN instance of the Y coordinate

`Point`

Will determine if the point is valid

**Kind**: instance method of `Point`

**Returns**: `Point`

- An instance of the same Point**Throws**:

`Error`

A validation error if exists

**Link**: https://www.iacr.org/archive/pkc2003/25670211/25670211.pdf

Param | Type | Description |
---|---|---|

An | `Point` |
instance of Point |

`Point`

Instantiate a valid secp256k1 Point from only the X coordinate

**Kind**: static method of `Point`

**Returns**: `Point`

- An instance of Point**Throws**:

`Error`

A validation error if exists

Param | Type | Description |
---|---|---|

odd | `boolean` |
If the Y coordinate is odd |

x | `BN` | `String` |
The X coordinate |

`Point`

Will return a secp256k1 ECDSA base point.

**Kind**: static method of `Point`

**Returns**: `Point`

- An instance of the base point.**Link**: https://en.bitcoin.it/wiki/Secp256k1

`BN`

Will return the max of range of valid private keys as governed by the secp256k1 ECDSA standard.

**Kind**: static method of `Point`

**Returns**: `BN`

- A BN instance of the number of points on the curve**Link**: https://en.bitcoin.it/wiki/Private_key#Range_of_valid_ECDSA_private_keys