minor.
This commit is contained in:
parent
284bba746a
commit
e59feaf695
@ -208,10 +208,7 @@ ec.privateKeyVerify = function privateKeyVerify(key) {
|
|||||||
|
|
||||||
key = new bn(key);
|
key = new bn(key);
|
||||||
|
|
||||||
if (key.cmpn(0) === 0 || key.cmp(ec.elliptic.curve.n) >= 0)
|
return key.cmpn(0) !== 0 && key.cmp(ec.elliptic.curve.n) < 0;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -858,12 +858,15 @@ utils.parseHost = function parseHost(addr) {
|
|||||||
if (typeof addr === 'object')
|
if (typeof addr === 'object')
|
||||||
return addr;
|
return addr;
|
||||||
|
|
||||||
if (addr.indexOf(']') !== -1)
|
if (addr[0] === '[') {
|
||||||
|
addr = addr.substring(1);
|
||||||
parts = addr.split(/\]:?/);
|
parts = addr.split(/\]:?/);
|
||||||
else
|
assert(parts.length === 2);
|
||||||
|
} else {
|
||||||
parts = addr.split(':');
|
parts = addr.split(':');
|
||||||
|
}
|
||||||
|
|
||||||
host = parts[0].replace(/[\[\]]/g, '');
|
host = parts[0];
|
||||||
port = +parts[1] || 0;
|
port = +parts[1] || 0;
|
||||||
|
|
||||||
if (utils.ip.version(host) !== -1)
|
if (utils.ip.version(host) !== -1)
|
||||||
@ -915,6 +918,7 @@ utils.ip.version = function version(ip) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether a buffer is an ipv4-mapped ipv6 address.
|
* Test whether a buffer is an ipv4-mapped ipv6 address.
|
||||||
|
* @param {Buffer} ip
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user