@atomicfinance/crypto 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.bech32 = exports.base58 = void 0;
|
|
7
|
+
exports.sha256 = sha256;
|
|
8
|
+
exports.ripemd160 = ripemd160;
|
|
9
|
+
exports.hash160 = hash160;
|
|
10
|
+
exports.ensureBuffer = ensureBuffer;
|
|
11
|
+
exports.padHexStart = padHexStart;
|
|
12
|
+
exports.isHex = isHex;
|
|
7
13
|
const bech32_1 = __importDefault(require("bech32"));
|
|
8
14
|
exports.bech32 = bech32_1.default;
|
|
9
15
|
const bs58_1 = __importDefault(require("bs58"));
|
|
@@ -15,7 +21,6 @@ function isHex(hex) {
|
|
|
15
21
|
const buf = Buffer.from(hex, 'hex').toString('hex');
|
|
16
22
|
return buf === hex.toLowerCase();
|
|
17
23
|
}
|
|
18
|
-
exports.isHex = isHex;
|
|
19
24
|
/**
|
|
20
25
|
* Ensure message is in buffer format.
|
|
21
26
|
* @param {string} message - any string.
|
|
@@ -37,7 +42,6 @@ function ensureBuffer(message) {
|
|
|
37
42
|
}
|
|
38
43
|
return Buffer.isBuffer(message) ? message : false;
|
|
39
44
|
}
|
|
40
|
-
exports.ensureBuffer = ensureBuffer;
|
|
41
45
|
/**
|
|
42
46
|
* Get hash of a message in hex.
|
|
43
47
|
* @param {!string} algorithm - Hashing algorithm.
|
|
@@ -55,7 +59,6 @@ function hashToHex(algorithm, message) {
|
|
|
55
59
|
function hash160(message) {
|
|
56
60
|
return hashToHex('hash160', message);
|
|
57
61
|
}
|
|
58
|
-
exports.hash160 = hash160;
|
|
59
62
|
/**
|
|
60
63
|
* Get sha256 of message.
|
|
61
64
|
* @param {!string|Buffer} message - message in string or Buffer.
|
|
@@ -64,7 +67,6 @@ exports.hash160 = hash160;
|
|
|
64
67
|
function sha256(message) {
|
|
65
68
|
return hashToHex('sha256', message);
|
|
66
69
|
}
|
|
67
|
-
exports.sha256 = sha256;
|
|
68
70
|
/**
|
|
69
71
|
* Get ripemd160 of message.
|
|
70
72
|
* @param {!string|Buffer} message - message in string or Buffer.
|
|
@@ -73,7 +75,6 @@ exports.sha256 = sha256;
|
|
|
73
75
|
function ripemd160(message) {
|
|
74
76
|
return hashToHex('ripemd160', message);
|
|
75
77
|
}
|
|
76
|
-
exports.ripemd160 = ripemd160;
|
|
77
78
|
/**
|
|
78
79
|
* Pad a hex string with '0'
|
|
79
80
|
* @param {string} hex - The hex string to pad.
|
|
@@ -86,5 +87,4 @@ function padHexStart(hex, lengthBytes) {
|
|
|
86
87
|
lengthString += lengthString % 2;
|
|
87
88
|
return hex.padStart(lengthString, '0');
|
|
88
89
|
}
|
|
89
|
-
exports.padHexStart = padHexStart;
|
|
90
90
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;AAiGE,wBAAM;AACN,8BAAS;AACT,0BAAO;AACP,oCAAY;AACZ,kCAAW;AACX,sBAAK;AAtGP,oDAA4B;AAgG1B,iBAhGK,gBAAM,CAgGL;AA/FR,gDAA0B;AAyFxB,iBAzFK,cAAM,CAyFL;AAxFR,oEAAwC;AAExC,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,CAAC,GAAG,C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