package: remove Makefile and dist

This commit is contained in:
Kirill Fomichev
2016-01-29 02:58:00 -05:00
committed by Fedor Indutny
parent b0a8f43981
commit 7cffa3b9e8
11 changed files with 34 additions and 13072 deletions
-23
View File
@@ -1,23 +0,0 @@
BROWSERIFY ?= ./node_modules/.bin/browserify
UGLIFY ?= ./node_modules/.bin/uglifyjs
JSCS ?= ./node_modules/.bin/jscs
JSHINT ?= ./node_modules/.bin/jshint
SOURCES = lib/*.js lib/**/*.js lib/**/**/*.js
all: dist/elliptic.js dist/elliptic.min.js \
dist/elliptic-small.js dist/elliptic-small.min.js
dist/elliptic.js: lib/elliptic.js
$(BROWSERIFY) --standalone ellipticjs $< -o $@
dist/elliptic-small.js: lib/elliptic.js
$(BROWSERIFY) --standalone ellipticjs --exclude lib/elliptic/precomputed/* $< -o $@
%.min.js: %.js
$(UGLIFY) --compress --mangle < $< > $@
lint: $(SOURCES)
$(JSCS) $(SOURCES) && $(JSHINT) $(SOURCES)
.PHONY: all lint
+2 -2
View File
@@ -95,7 +95,7 @@ add('sign', {
},
secp256k1: function() {
secp256k1.sign(k4priv, m4);
},
}
});
var os1 = crypto.createSign('RSA-SHA256').update(str).sign(ok);
@@ -118,7 +118,7 @@ add('verify', {
},
secp256k1: function() {
secp256k1.verify(k4pub, m4, s4);
},
}
});
add('gen', {
View File
-6114
View File
File diff suppressed because it is too large Load Diff
-3
View File
File diff suppressed because one or more lines are too long
-6896
View File
File diff suppressed because it is too large Load Diff
-4
View File
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -9,7 +9,9 @@
"scripts": {
"coverage": "npm run unit --coverage",
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
"lint": "make lint",
"jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/*.js",
"jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/*.js",
"lint": "npm run jscs && npm run jshint",
"test": "npm run lint && npm run unit",
"unit": "istanbul test _mocha --reporter=spec test/*-test.js"
},
@@ -30,13 +32,11 @@
},
"homepage": "https://github.com/indutny/elliptic",
"devDependencies": {
"browserify": "^3.44.2",
"coveralls": "^2.11.3",
"istanbul": "^0.3.17",
"jscs": "^1.11.3",
"istanbul": "^0.4.2",
"jscs": "^2.9.0",
"jshint": "^2.6.0",
"mocha": "^2.1.0",
"uglify-js": "^2.4.13"
"mocha": "^2.1.0"
},
"dependencies": {
"bn.js": "^4.0.0",
+14 -14
View File
@@ -77,7 +77,7 @@ describe('ECDSA', function() {
it('should have another signature with pers', function () {
var sign1 = keys.sign(msg);
var sign2 = keys.sign(msg, {pers: '1234', persEnc: 'hex'});
var sign2 = keys.sign(msg, { pers: '1234', persEnc: 'hex' });
assert.notEqual(sign1.r.toArray().concat(sign1.s.toArray()),
sign2.r.toArray().concat(sign2.s.toArray()));
});
@@ -183,7 +183,7 @@ describe('ECDSA', function() {
r: '3a718bd8b4926c3b52ee6bbe67ef79b18cb6eb62b1ad97ae',
s: '5662e6848a4a19b1f1ae2f72acd4b8bbe50f1eac65d9124f'
}
],
]
});
test({
@@ -219,7 +219,7 @@ describe('ECDSA', function() {
r: 'ad04dde87b84747a243a631ea47a1ba6d1faa059149ad2440de6fba6',
s: '178d49b1ae90e3d8b629be3db5683915f4e8c99fdf6e666cf37adcfd'
}
],
]
});
test({
@@ -255,7 +255,7 @@ describe('ECDSA', function() {
r: 'f1abb023518351cd71d881567b1ea663ed3efcf6c5132b354f28d3b0b7d38367',
s: '19f4113742a2b14bd25926b49c649155f267e60d3814b4c0cc84250e46f0083'
}
],
]
});
test({
@@ -294,7 +294,7 @@ describe('ECDSA', function() {
s: 'ddd0760448d42d8a43af45af836fce4de8be06b485e9b61b827c2f13' +
'173923e06a739f040649a667bf3b828246baa5a5'
}
],
]
});
test({
@@ -325,11 +325,11 @@ describe('ECDSA', function() {
message: 'sample',
hash: hash.sha512,
r: 'c328fafcbd79dd77850370c46325d987cb525569fb63c5d3bc53950e6d4c5f1' +
'74e25a1ee9017b5d450606add152b534931d7d4e8455cc91f9b15bf05ec36e37' +
'7fa',
'74e25a1ee9017b5d450606add152b534931d7d4e8455cc91f9b15bf05ec36e3' +
'77fa',
s: '617cce7cf5064806c467f678d3b4080d6f1cc50af26ca209417308281b68af2' +
'82623eaa63e5b5c0723d8b8c37ff0777b1a20f8ccb1dccc43997f1ee0e44da4a' +
'67a'
'82623eaa63e5b5c0723d8b8c37ff0777b1a20f8ccb1dccc43997f1ee0e44da4' +
'a67a'
},
{
message: 'test',
@@ -341,7 +341,7 @@ describe('ECDSA', function() {
'f7e78a19ca69eff5c57400e3b3a0ad66ce0978214d13baf4e9ac60752f7b15' +
'5e2de4dce3'
}
],
]
});
});
@@ -359,7 +359,7 @@ describe('ECDSA', function() {
'6160edb2b218b7f1394b9ca8eb65a72831032a1f2f3dc2d99291c2f7950ed887');
});
it('should recover the public key from a signature', function(){
it('should recover the public key from a signature', function() {
var ec = new elliptic.ec('secp256k1');
var key = ec.genKeyPair();
var msg = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
@@ -379,19 +379,19 @@ describe('ECDSA', function() {
assert.throws(function() {
ecdsa.recoverPubKey(message, {
r: 'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140',
s: '8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3',
s: '8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3'
}, 0);
});
});
describe('Signature', function () {
it('recoveryParam is 0', function () {
var sig = new Signature({r: '00', s: '00', recoveryParam: 0});
var sig = new Signature({ r: '00', s: '00', recoveryParam: 0 });
assert.equal(sig.recoveryParam, 0);
});
it('recoveryParam is 1', function () {
var sig = new Signature({r: '00', s: '00', recoveryParam: 1});
var sig = new Signature({ r: '00', s: '00', recoveryParam: 1 });
assert.equal(sig.recoveryParam, 1);
});
});
+11 -9
View File
@@ -15,7 +15,8 @@ var MAX_PROGRAMMATIC = process.env.CI ? Infinity : 50;
describe('ed25519 derivations', function() {
var expectedTests = 256;
var ed25519, derivations;
var ed25519;
var derivations;
before(function() {
ed25519 = new eddsa('ed25519');
@@ -42,14 +43,15 @@ describe('ed25519 derivations', function() {
describe('sign.input ed25519 test vectors', function() {
var expectedTests = 1024;
var ed25519, lines;
var ed25519;
var lines;
before(function(done) {
ed25519 = new eddsa('ed25519');
fs.readFile(__dirname + '/fixtures/sign.input', function(err, f) {
lines = f.toString().split('\n');
assert.equal(lines.length, expectedTests + 1 /*blank line*/);
done();
lines = f.toString().split('\n');
assert.equal(lines.length, expectedTests + 1 /*blank line*/);
done();
});
});
@@ -70,9 +72,9 @@ describe('sign.input ed25519 test vectors', function() {
assert.equal(sigS, split[3].slice(64, 128));
assert(key.verify(msg, sig));
var forged = msg.length === 0 ? [0x78] /*ord('x')*/:
msg.slice(0, msg.length-1).concat(
(msg[(msg.length-1)] + 1) % 256);
var forged = msg.length === 0 ? [ 0x78 ] /*ord('x')*/:
msg.slice(0, msg.length - 1).concat(
(msg[(msg.length - 1)] + 1) % 256);
assert.equal(msg.length || 1, forged.length);
assert(!key.verify(forged, sig));
@@ -96,7 +98,7 @@ describe('EDDSA(\'ed25519\')', function() {
it('can sign/verify messages', function() {
var secret = toArray(new Array(65).join('0'), 'hex');
assert(secret.length === 32);
var msg = [0xB, 0xE, 0xE, 0xF];
var msg = [ 0xB, 0xE, 0xE, 0xF ];
var key = ed25519.keyFromSecret(secret);
var sig = key.sign(msg).toHex();
+1 -1
View File
@@ -29,7 +29,7 @@ describe('Hmac_DRBG', function() {
pers: null,
size: 32,
res: 'ed5d61ecf0ef38258e62f03bbb49f19f2cd07ba5145a840d83b134d5963b3633'
},
}
];
for (var i = 0; i < test.length; i++)
assert.equal(doDrbg(test[i]), test[i].res);