@btc-vision/btc-runtime 1.0.2 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btc-vision/btc-runtime",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Bitcoin Smart Contract Runtime",
5
5
  "main": "btc/index.ts",
6
6
  "types": "btc/index.ts",
@@ -223,8 +223,7 @@ export class Sha256 {
223
223
  * @returns A hash function state
224
224
  */
225
225
  constructor() {
226
- let st = Internal._hashInit();
227
- this.st = st;
226
+ this.st = Internal._hashInit();
228
227
  }
229
228
 
230
229
  /**
@@ -248,6 +247,15 @@ export class Sha256 {
248
247
  return Internal._hmac(m, k);
249
248
  }
250
249
 
250
+ /**
251
+ * Hash256
252
+ * @param {Uint8Array} m Message
253
+ * @returns {Uint8Array} `SHA-256(SHA-256(m))`
254
+ */
255
+ static hash256(m: Uint8Array): Uint8Array {
256
+ return Sha256.hash(Sha256.hash(m));
257
+ }
258
+
251
259
  /**
252
260
  * Absorb data to be hashed
253
261
  * @param m (partial) message