// Overwrite NIST-P256 with secp256k1 so we're on even footingsjcl.ecc.curves.c256=new sjcl.ecc.curve( sjcl.bn.pseudoMersennePrime(256,[[0,-1],[4,-1],[6,-1],[7,-1],[8,-1],[9,-1],[32,-1]]),"0x14551231950b75fc4402da1722fc9baee",0,7,"0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8");

// Replace point addition and doubling algorithms// NIST-P256 is a=-3, we need algorithms for a=0sjcl.ecc.pointJac.prototype.add=function(T){var S =this;if(S.curve!== T.curve){throw("sjcl.ecc.add(): Points must be on the same curve to add them!");}

// If k1 or k2 are negative we have to multiply them with the inverse of Q1// or Q2 respectively.//// However, if we took this naive approach, we would need to precompute// multiples for the inverses of both Q1 and Q2. Instead, if k2 is negative,// we choose to invert the result. Then if k1 is not negative, we invert Q1.var invertResult =false;if(!k2.greaterEquals(0)){ invertResult =true; k2 = k2.abs();