Typo fixes
This commit is contained in:
parent
22cc03604f
commit
a47563ee8c
|
@ -69,7 +69,7 @@ function getchecksum(data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get RIPEMD160(SHA512(SIGN_PUBLIC_KEY || ENC_PUBLIC_KEY))
|
// Get RIPEMD160(SHA512(SIGN_PUBLIC_KEY || ENC_PUBLIC_KEY)).
|
||||||
// Arguments could be either private or public keys. Private keys are
|
// Arguments could be either private or public keys. Private keys are
|
||||||
// **always** 32 bytes in length.
|
// **always** 32 bytes in length.
|
||||||
function keys2ripe(signKey, encKey) {
|
function keys2ripe(signKey, encKey) {
|
||||||
|
@ -122,7 +122,7 @@ function assertstream(stream) {
|
||||||
assert(stream, "No stream");
|
assert(stream, "No stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get truncated ripe hash length.
|
// Get truncated Ripe hash length.
|
||||||
function getripelen(ripe) {
|
function getripelen(ripe) {
|
||||||
var zeroes = 0;
|
var zeroes = 0;
|
||||||
for (var i = 0; i < 20, ripe[i] === 0; i++) {
|
for (var i = 0; i < 20, ripe[i] === 0; i++) {
|
||||||
|
@ -131,7 +131,7 @@ function getripelen(ripe) {
|
||||||
return 20 - zeroes;
|
return 20 - zeroes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do neccessary checkings of the truncated ripe hash length depending
|
// Do neccessary checkings of the truncated Ripe hash length depending
|
||||||
// on the address version.
|
// on the address version.
|
||||||
function assertripelen(ripelen, version) {
|
function assertripelen(ripelen, version) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
|
@ -152,7 +152,7 @@ function assertripelen(ripelen, version) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The same as `assertripelen` but return true/false instead of throw an
|
// The same as `assertripelen` but return boolean instead of thrown an
|
||||||
// Error.
|
// Error.
|
||||||
function checkripelen(ripelen, version) {
|
function checkripelen(ripelen, version) {
|
||||||
try {
|
try {
|
||||||
|
@ -210,8 +210,8 @@ exports.encode = function(addr) {
|
||||||
*/
|
*/
|
||||||
exports.getRandom = function(opts) {
|
exports.getRandom = function(opts) {
|
||||||
var version, stream, ripelen, signPrivateKey;
|
var version, stream, ripelen, signPrivateKey;
|
||||||
try {
|
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
try {
|
||||||
version = opts.version || 4;
|
version = opts.version || 4;
|
||||||
assertversion(version);
|
assertversion(version);
|
||||||
stream = opts.stream || 1;
|
stream = opts.stream || 1;
|
||||||
|
@ -224,12 +224,12 @@ exports.getRandom = function(opts) {
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
return Promise.reject(e);
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
var nextTick = typeof setImmediate === "undefined" ?
|
|
||||||
process.nextTick :
|
|
||||||
setImmediate;
|
|
||||||
// Should the generated Ripe length be strictly equal to the specified
|
// Should the generated Ripe length be strictly equal to the specified
|
||||||
// (less-or-equal by default);
|
// (less-or-equal by default);
|
||||||
var strictripelen = !!opts.strictripelen;
|
var strictripelen = !!opts.strictripelen;
|
||||||
|
var nextTick = typeof setImmediate === "undefined" ?
|
||||||
|
process.nextTick :
|
||||||
|
setImmediate;
|
||||||
var signPublicKey = bmcrypto.getPublic(signPrivateKey);
|
var signPublicKey = bmcrypto.getPublic(signPrivateKey);
|
||||||
|
|
||||||
// FIXME(Kagami): This function is rather slow in browsers so
|
// FIXME(Kagami): This function is rather slow in browsers so
|
||||||
|
|
|
@ -29,8 +29,8 @@ exports.sha256 = function(buf) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.ripemd160 = function(buf) {
|
exports.ripemd160 = function(buf) {
|
||||||
// XXX(Kagami): No support in browsers via Web Crypto API currently,
|
// XXX(Kagami): RIPEMD is not defined in WebCryptoAPI so we provide it
|
||||||
// so use module.
|
// using pure JS third-party implementation.
|
||||||
return Promise.resolve(ripemd160(buf));
|
return Promise.resolve(ripemd160(buf));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* Isomorphic Bitmessage crypto module. Reexport platform-specific
|
* Isomorphic Bitmessage crypto module. Reexports platform-specific
|
||||||
* functions and also export some common routines.
|
* functions and also some common routines.
|
||||||
* @module bitmessage/crypto
|
* @module bitmessage/crypto
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Main Bitmessage module. Just reexports all public submodules.
|
* Main Bitmessage module. Just reexports all main submodules.
|
||||||
* @module bitmessage
|
* @module bitmessage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user