@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 +1 -1
- package/runtime/math/sha256.ts +10 -2
package/package.json
CHANGED
package/runtime/math/sha256.ts
CHANGED
|
@@ -223,8 +223,7 @@ export class Sha256 {
|
|
|
223
223
|
* @returns A hash function state
|
|
224
224
|
*/
|
|
225
225
|
constructor() {
|
|
226
|
-
|
|
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
|