UNPKG

@kraken-crypto/ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

17 lines (16 loc) 632 B
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ import { hmac } from '../noble-hashes/hmac.js'; import { concatBytes, randomBytes } from '../noble-hashes/utils.js'; import { weierstrass } from './abstract/weierstrass.js'; // connects noble-curves to noble-hashes export function getHash(hash) { return { hash, hmac: (key, ...msgs) => hmac(hash, key, concatBytes(...msgs)), randomBytes, }; } export function createCurve(curveDef, defHash) { const create = (hash) => weierstrass({ ...curveDef, ...getHash(hash) }); return Object.freeze({ ...create(defHash), create }); }