Commit Graph

39 Commits

Author SHA1 Message Date
Ryan X. Charles
0251d467c4 update bn.js to latest version
...and correspondingly get rid of Number->String conversion

See: https://github.com/indutny/bn.js/issues/17
2014-07-15 11:25:18 -07:00
Linus Unnebäck
3da6fe899f cleanup after removal of soop
Removed some unnecessary parenthesise that hung around after the merge
of #417
2014-07-12 12:14:56 +02:00
Ryan X. Charles
8a199e26f3 allow Point to multiply things other than buffers
...i.e., bignums, numbers, and strings. Also, ensure that if you try to
multiply a buffer, it should be exactly 32 bytes. Eventually this "multiply"
function will be replaced with a more conventional "mul" function, but not yet.
2014-07-11 11:52:05 -07:00
Ryan X. Charles
3cbf2e07c4 use decorate on gt and lt 2014-07-10 18:45:27 -07:00
Ryan X. Charles
80bba1cf81 use a decorate function to optimize bundle filesize 2014-07-10 18:27:15 -07:00
Ryan X. Charles
af1d754bd8 make bignum interface backwards compatible
- fix cmp, mul, div, add, mod, sub functions to take numbers and strings
- fix Point class to use common folder correctly
2014-07-10 18:14:13 -07:00
Ryan X. Charles
e4cb7d2014 remoe unimplemented bignum.pow() 2014-07-10 16:47:05 -07:00
Ryan X. Charles
c8f11b9c0a require Point ... woops 2014-07-10 16:22:42 -07:00
Ryan X. Charles
204d8563c8 remove cryptojs dependency from Key 2014-07-10 16:22:42 -07:00
Ryan X. Charles
ac4d3186bf update sign function to use elliptic 2014-07-10 16:22:42 -07:00
Ryan X. Charles
8fb6ccaf01 use elliptic for Point.multiply and key regeneration 2014-07-10 16:22:42 -07:00
Ryan X. Charles
15d4328b35 use elliptic in Point in the browser instead of cryptojs 2014-07-10 16:21:08 -07:00
Ryan X. Charles
c8fe404402 replace bignumber.js with bn.js 2014-07-10 16:20:13 -07:00
Manuel Araoz
87b818badf remove soop exports 2014-07-10 16:08:42 -03:00
Manuel Araoz
6e346d067c remove soop imports 2014-07-10 12:39:09 -03:00
Ryan X. Charles
65ab3a663a fix string/buffer sjcl issue
...by using sjcl.mode.cbc.encrypt/decrypt rather than sjcl.encrypt/decrypt. The
difference is that the sjcl.encrypt/decrypt functions are really convenience
methods designed to encrypt and decrypt strings, but don't play nice with
binary data, as revealed in the tests in this commit and the previous commit.
Basically, if you use them to encrypt and decrypt binary data as a string, it
will return the wrong result or an error.

The solution is to use the block cipher directly, in this case sjcl.mode.cbc.
This also has the advantage of fewer format conversions - no converting to
base64 and JSON strings. This makes things faster. Also, it is actually correct
unlike the previous method.
2014-07-09 16:25:48 -07:00
Ryan X. Charles
ca67786a77 ran js-beautify on all bitcore source
js-beautify -s 2 -r *.js

...did not run on bundles, only on source.
2014-06-23 10:57:02 -07:00
Ryan X. Charles
54c8e04738 remove unbuilding c code, and ...
* Remove c code that didn't compile on my machine
* Replace with sjcl code
* Minor modifications to mnemonic interface more bitcoreish
2014-06-20 19:09:21 -07:00
Devrandom
b523eee812 Switch BIP-0039 to sjcl in browser 2014-06-08 13:30:47 -07:00
Devrandom
79d50e92d4 BIP39 in browser 2014-06-08 12:43:05 -07:00
Ryan X. Charles
338158ca46 fix sjcl issue on npm install
...by including sjcl locally
2014-06-06 11:49:58 -07:00
Ryan X. Charles
2dac2b1f47 Merge pull request #362 from ryanxcharles/feature/ECIES
add ECIES support
2014-06-05 20:31:08 -07:00
Ryan X. Charles
af9fdff3a9 use SJCL AES to get ECIES working in the browser 2014-06-03 19:03:50 -07:00
Rich Morgan
eab5c2896e Fix to check for zero s value in sign function
If r OR s are zero then recalculate both r and s until they are both non-zero values.
2014-05-28 11:34:18 -04:00
olalonde
59ee476b96 Armory: use native multiplication in node and javascript implementation in browser 2014-05-08 07:54:12 +08:00
olalonde
e2655f553d Added EC Point multiplication to browser/Point.js 2014-05-08 07:54:11 +08:00
olalonde
78ae388553 Replace process.versions tests by browserify's package.json browser field. Fixes #329 2014-05-07 14:14:10 +08:00
Ryan X. Charles
527c49a11d remove unused chai dependency 2014-05-05 11:04:24 -04:00
Ryan X. Charles
b1f34d4015 iterate array correctly so that random number is actually used in signing 2014-05-01 10:09:33 -04:00
Ryan X. Charles
405ea0bf6f fix bignum issue
In the browser, sometimes the config for bignum wasn't being set up if (somehow
... still not sure how this is possible) you use bitcore without using
require('bitcore'). This would by pass the code that set the config for bignum.
Solution is to put the config for bignum in bignum itself (in the browser).

This fixes, in particular, an issue with base58 where it was depending on
bignum having the proper config.

Also I add the base58 tests to run in the browser which they weren't
previously.

And finally I add a small test for Bignum in the browser that makes sure the
config is set properly.
2014-04-29 17:59:24 -04:00
Ryan X. Charles
7f348ca0bd Move BigNumber to internal
...no longer relies on Manuel's repo hostig a version of "bignum" that actually
contained bignumber.js. This moves bignumber.js internally and removes bignum
from the browser build process. Also adds a bitcore.Bignum that links to the
right thing. In node, browser.Bignum is require('bignum'). And in the browser,
bitcore.Bignum is is now Bignumber.js (same as before ... except bignumber.js
is now inside bitcore).
2014-04-28 18:00:59 -04:00
Ryan X. Charles
c7b33eca9a update key signing to use new SecureRandom
...and throw an error if you try to use the old, non-secure random number
generator.
2014-04-25 15:00:51 -03:00
Ryan X. Charles
10d164b292 add require('bignum') in key 2014-04-24 15:33:38 -03:00
Ryan X. Charles
9575929162 Merge branch 'feature/secure-random'
Conflicts:
	lib/browser/Key.js
2014-04-24 09:19:58 -03:00
Matias Alejo Garcia
64b5623d54 removes buffertools dependencies in browsers Key.js 2014-04-23 21:32:25 -03:00
Ryan X. Charles
350f6ae998 Key should make sure new privkey is less than N
...this involves adding a Curve class, and significant refactoring to make this
possible in a clean way.
2014-04-23 21:15:55 -03:00
Ryan X. Charles
dbcf270826 use SecureRandom in Key in the browser
...to make sure random numbers are generated securely
2014-04-22 22:43:22 -03:00
Ryan X. Charles
ba692aaa20 add new SecureRandom class that does the right thing
Generating random numbers properly depends on the platform. The new
getRandomBuffer method does the right thing on the right platform. It will
sometimes fail due to insufficient entropy. The getPseudoRandomBuffer class is
also provided that will never fail, but it is not cryptographically secure and
should not be used for keys.
2014-04-22 22:18:59 -03:00
Ryan X. Charles
f82fa5007a move *.browser and *.node to browser/* and node/*
...this should leave the lib folder a little bit less cluttered.
2014-04-22 19:36:18 -03:00