@ocap/mcrypto 1.18.22 → 1.18.24

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/lib/index.d.ts CHANGED
@@ -227,3 +227,4 @@ export declare const Signers: Readonly<{
227
227
  export declare const Hashers: Readonly<{
228
228
  [x: number]: (data: BytesType, round?: number, encoding?: EncodingType) => BytesType;
229
229
  }>;
230
+ export declare const toTxHash: (buf: Buffer | Uint8Array) => string;
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ 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.Hashers = exports.Signers = exports.getRandomBytes = exports.getHasher = exports.getSigner = exports.types = exports.Hasher = exports.Signer = void 0;
6
+ exports.toTxHash = exports.Hashers = exports.Signers = exports.getRandomBytes = exports.getHasher = exports.getSigner = exports.types = exports.Hasher = exports.Signer = void 0;
7
7
  const randombytes_1 = __importDefault(require("randombytes"));
8
8
  const encode_1 = require("./encode");
9
9
  const keccak_1 = __importDefault(require("./hasher/keccak"));
@@ -219,3 +219,5 @@ exports.Hashers = Object.freeze({
219
219
  [exports.types.HashType.SHA3_512]: exports.Hasher.SHA3.hash512,
220
220
  [exports.types.HashType.SHA2]: exports.Hasher.SHA2.hash256,
221
221
  });
222
+ const toTxHash = (buf) => exports.Hasher.SHA2.hash256(buf, 1, 'hex').replace(/^0x/, '').toUpperCase();
223
+ exports.toTxHash = toTxHash;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocap/mcrypto",
3
- "version": "1.18.22",
3
+ "version": "1.18.24",
4
4
  "description": "Crypto lib that provides signer,crypter,hasher interface",
5
5
  "keywords": [
6
6
  "crypto",
@@ -56,7 +56,7 @@
56
56
  "url": "https://github.com/ArcBlock/asset-chain/issues"
57
57
  },
58
58
  "dependencies": {
59
- "@ocap/util": "1.18.22",
59
+ "@ocap/util": "1.18.24",
60
60
  "bn.js": "5.2.1",
61
61
  "crypto-js": "^4.1.1",
62
62
  "elliptic": "^6.5.4",
@@ -72,5 +72,5 @@
72
72
  "bn.js": "5.2.1",
73
73
  "elliptic": "6.5.3"
74
74
  },
75
- "gitHead": "7f833da5b1ed75fd2f2427925d0cbb84af33b36b"
75
+ "gitHead": "2b3c7ab2de31bd3ef55ae32cec5c007d5e13d306"
76
76
  }