use native pbkdf2.

This commit is contained in:
Christopher Jeffrey 2016-02-12 15:41:48 -08:00
parent da19b6da29
commit 4e34d3d0ca

View File

@ -1123,12 +1123,16 @@ function array32(data) {
/**
* PDKBF2
* Credit to: https://github.com/stayradiated/pbkdf2-sha512
* Copyright (c) 2014, JP Richardson Copyright (c) 2010-2011 Intalio Pte, All Rights Reserved
* Copyright (c) 2010-2011 Intalio Pte, All Rights Reserved
* Copyright (c) 2014, JP Richardson
*/
function pbkdf2(key, salt, iterations, dkLen) {
'use strict';
if (bcoin.crypto && bcoin.crypto.pbkdf2Sync)
return bcoin.crypto.pbkdf2Sync(key, salt, iterations, dkLen, 'sha512');
var hLen = 64;
if (dkLen > (Math.pow(2, 32) - 1) * hLen)
@ -1191,7 +1195,7 @@ var cache = {
cache.set = function(key, index, value) {
key = key + '/' + index;
if (this.count > 200) {
if (this.count > 500) {
this.data = {};
this.count = 0;
}