use native pbkdf2.
This commit is contained in:
parent
da19b6da29
commit
4e34d3d0ca
@ -1123,12 +1123,16 @@ function array32(data) {
|
|||||||
/**
|
/**
|
||||||
* PDKBF2
|
* PDKBF2
|
||||||
* Credit to: https://github.com/stayradiated/pbkdf2-sha512
|
* 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) {
|
function pbkdf2(key, salt, iterations, dkLen) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
if (bcoin.crypto && bcoin.crypto.pbkdf2Sync)
|
||||||
|
return bcoin.crypto.pbkdf2Sync(key, salt, iterations, dkLen, 'sha512');
|
||||||
|
|
||||||
var hLen = 64;
|
var hLen = 64;
|
||||||
|
|
||||||
if (dkLen > (Math.pow(2, 32) - 1) * hLen)
|
if (dkLen > (Math.pow(2, 32) - 1) * hLen)
|
||||||
@ -1191,7 +1195,7 @@ var cache = {
|
|||||||
cache.set = function(key, index, value) {
|
cache.set = function(key, index, value) {
|
||||||
key = key + '/' + index;
|
key = key + '/' + index;
|
||||||
|
|
||||||
if (this.count > 200) {
|
if (this.count > 500) {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user