diff --git a/Gruntfile.js b/Gruntfile.js index a8e344ad8..934a78dfd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,7 +4,6 @@ module.exports = function(grunt) { //Load NPM tasks grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-mocha-test'); grunt.loadNpmTasks('grunt-markdown'); grunt.loadNpmTasks('grunt-shell'); @@ -30,12 +29,6 @@ module.exports = function(grunt) { tasks: ['shell'], }, }, - mochaTest: { - options: { - reporter: 'spec', - }, - src: ['test/*.js'], - }, markdown: { all: { files: [{ diff --git a/index.js b/index.js index 757dd2127..447ac870c 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,6 @@ bitcore.Varint = require('./lib/protocol/varint'); // crypto bitcore.BN = require('./lib/crypto/bn'); -bitcore.KDF = require('./lib/crypto/kdf'); bitcore.ECDSA = require('./lib/crypto/ecdsa'); bitcore.Hash = require('./lib/crypto/hash'); bitcore.Random = require('./lib/crypto/random'); diff --git a/lib/crypto/kdf.js b/lib/crypto/kdf.js deleted file mode 100644 index afbbbea9f..000000000 --- a/lib/crypto/kdf.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -var Bn = require('./bn'); -var Point = require('./point'); -var Hash = require('./hash'); -var Privkey = require('../privkey'); -var Keypair = require('../keypair'); - -function KDF() { -} - -KDF.buf2keypair = function(buf) { - return KDF.sha256hmac2keypair(buf); -}; - -KDF.sha256hmac2keypair = function(buf) { - var privkey = KDF.sha256hmac2privkey(buf); - var keypair = Keypair().fromPrivkey(privkey); - return keypair; -}; - -KDF.sha256hmac2privkey = function(buf) { - var bn; - var concat = new Buffer([]); - do { - var hash = Hash.sha256hmac(buf, concat); - var bn = Bn.fromBuffer(hash); - concat = Buffer.concat([concat, new Buffer(0)]); - } while(!bn.lt(Point.getN())); - return new Privkey({bn: bn}); -}; - -module.exports = KDF; diff --git a/package.json b/package.json index 4aa236434..a2f116cc4 100644 --- a/package.json +++ b/package.json @@ -72,9 +72,13 @@ "sha512": "=0.0.1" }, "devDependencies": { + "browserify": "~5.9.1", "chai": "~1.9.1", - "mocha": "~1.21.0", - "browserify": "~5.9.1" + "grunt": "^0.4.5", + "grunt-contrib-watch": "^0.6.1", + "grunt-markdown": "^0.6.1", + "grunt-shell": "^1.1.1", + "mocha": "~1.21.0" }, "license": "MIT" } diff --git a/test/crypto/kdf.js b/test/crypto/kdf.js deleted file mode 100644 index f9ee35fa8..000000000 --- a/test/crypto/kdf.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var should = require('chai').should(); -var bitcore = require('bitcore'); -var KDF = bitcore.KDF; -var Hash = bitcore.Hash; - -describe('KDF', function() { - - describe('#buf2keypair', function() { - - it('should compute these known values', function() { - var buf = Hash.sha256(new Buffer('test')); - var keypair = KDF.buf2keypair(buf); - keypair.privkey.toString().should.equal('KxxVszVMFLGzmxpxR7sMSaWDmqMKLVhKebX5vZbGHyuR8spreQ7V'); - keypair.pubkey.toString().should.equal('03774f761ae89a0d2fda0d532bad62286ae8fcda9bc38c060036296085592a97c1'); - }); - - }); - - describe('#sha256hmac2keypair', function() { - - it('should compute these known values', function() { - var buf = Hash.sha256(new Buffer('test')); - var keypair = KDF.sha256hmac2keypair(buf); - keypair.privkey.toString().should.equal('KxxVszVMFLGzmxpxR7sMSaWDmqMKLVhKebX5vZbGHyuR8spreQ7V'); - keypair.pubkey.toString().should.equal('03774f761ae89a0d2fda0d532bad62286ae8fcda9bc38c060036296085592a97c1'); - }); - - }); - - describe('#sha256hmac2privkey', function() { - - it('should compute this known privkey', function() { - var buf = Hash.sha256(new Buffer('test')); - var privkey = KDF.sha256hmac2privkey(buf); - privkey.toString().should.equal('KxxVszVMFLGzmxpxR7sMSaWDmqMKLVhKebX5vZbGHyuR8spreQ7V'); - }); - - }); - -});