@@ -188,7 +188,8 @@ function toByteArray (b64) {
188188    ? validLen - 4
189189    : validLen
190190
191-   for (var i = 0; i < len; i += 4) {
191+   var i
192+   for (i = 0; i < len; i += 4) {
192193    tmp =
193194      (revLookup[b64.charCodeAt(i)] << 18) |
194195      (revLookup[b64.charCodeAt(i + 1)] << 12) |
@@ -2392,6 +2393,7 @@ module.exports = BigNumber;
23922393
23932394}).call(this,require("buffer").Buffer)
23942395},{"buffer":4}],4:[function(require,module,exports){
2396+ (function (Buffer){
23952397/*!
23962398 * The buffer module from node.js, for the browser.
23972399 *
@@ -4170,7 +4172,8 @@ function numberIsNaN (obj) {
41704172  return obj !== obj // eslint-disable-line no-self-compare
41714173}
41724174
4173- },{"base64-js":2,"ieee754":35}],5:[function(require,module,exports){
4175+ }).call(this,require("buffer").Buffer)
4176+ },{"base64-js":2,"buffer":4,"ieee754":35}],5:[function(require,module,exports){
41744177/*
41754178 * The MIT License (MIT)
41764179 *
@@ -13701,12 +13704,8 @@ var base32 = require('./base32');
1370113704var BigNum = require('browserify-bignum');
1370213705var groestl = require('groestl-hash-js');
1370313706
13704- function numberToHex(number) {
13705-     var hex = Math.round(number).toString(16)
13706-     if (hex.length === 1) {
13707-         hex = '0' + hex
13708-     }
13709-     return hex
13707+ function numberToHex(number, sizeInBytes) {
13708+     return Math.round(number).toString(16).padStart(sizeInBytes * 2, '0');
1371013709}
1371113710
1371213711function isHexChar(c) {
@@ -13774,10 +13773,11 @@ function hexStr2byteArray(str) {
1377413773}
1377513774
1377613775module.exports = {
13776+     numberToHex,
1377713777    toHex: function (arrayOfBytes) {
1377813778        var hex = '';
1377913779        for (var i = 0; i < arrayOfBytes.length; i++) {
13780-             hex += numberToHex(arrayOfBytes[i]);
13780+             hex += numberToHex(arrayOfBytes[i], 1 );
1378113781        }
1378213782        return hex;
1378313783    },
@@ -15387,52 +15387,45 @@ module.exports = {
1538715387
1538815388
1538915389},{}],160:[function(require,module,exports){
15390- var  baseX = require('base-x');
15391- var  crc = require('crc');
15392- var  cryptoUtils = require('./crypto/utils');
15390+ const  baseX = require('base-x');
15391+ const  crc = require('crc');
15392+ const  cryptoUtils = require('./crypto/utils');
1539315393
15394-  var  ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
15394+ const  ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
1539515395
15396-  var  base32 = baseX(ALPHABET);
15397- var  regexp = new RegExp('^[' + ALPHABET + ']{56}$');
15398- var  ed25519PublicKeyVersionByte = (6 << 3);
15396+ const  base32 = baseX(ALPHABET);
15397+ const  regexp = new RegExp('^[' + ALPHABET + ']{56}$');
15398+ const  ed25519PublicKeyVersionByte = (6 << 3);
1539915399
15400-   function swap16(number) {
15401-     var  lower = number & 0xFF;
15402-     var  upper = (number >> 8) & 0xFF;
15400+ function swap16(number) {
15401+     const  lower = number & 0xFF;
15402+     const  upper = (number >> 8) & 0xFF;
1540315403    return (lower << 8) | upper;
1540415404}
1540515405
15406-  function numberToHex(number) {
15407-     var hex = number.toString(16);
15408-     if(hex.length % 2 === 1) {
15409-         hex = '0' + hex;
15410-     }
15411-     return hex;
15412- }
15413- 
15414-  module.exports = {
15406+ module.exports = {
1541515407    isValidAddress: function (address) {
1541615408        if (regexp.test(address)) {
1541715409            return this.verifyChecksum(address);
1541815410        }
1541915411
15420-           return false;
15412+         return false;
1542115413    },
1542215414
1542315415     verifyChecksum: function (address) {
15424-         // based on https://github.com/stellar/js-stellar-base/blob/master/src/strkey.js#L126 
15425-         var  bytes = base32.decode(address);
15416+         // based on https://github.com/stellar/js-stellar-base/blob/master/src/strkey.js
15417+         const  bytes = base32.decode(address);
1542615418        if (bytes[0] !== ed25519PublicKeyVersionByte) {
1542715419            return false;
1542815420        }
1542915421
15430-          var computedChecksum = numberToHex(swap16(crc.crc16xmodem( bytes.slice(0, -2))) );
15431-         var  checksum = cryptoUtils.toHex(bytes.slice(-2));
15432- 
15433-           return computedChecksum === checksum
15422+         const payload =  bytes.slice(0, -2);
15423+         const  checksum = cryptoUtils.toHex(bytes.slice(-2));
15424+         const computedChecksum = cryptoUtils.numberToHex(swap16(crc.crc16xmodem(payload)), 2); 
15425+         return computedChecksum === checksum; 
1543415426    }
1543515427};
15428+ 
1543615429},{"./crypto/utils":145,"base-x":1,"crc":30}],161:[function(require,module,exports){
1543715430const path = require('path')
1543815431const BTCValidator = require('./bitcoin_validator');
0 commit comments