@bsv/sdk 1.9.24 → 1.9.29

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.
Files changed (59) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/primitives/AESGCM.js +160 -76
  3. package/dist/cjs/src/primitives/AESGCM.js.map +1 -1
  4. package/dist/cjs/src/primitives/Point.js +41 -18
  5. package/dist/cjs/src/primitives/Point.js.map +1 -1
  6. package/dist/cjs/src/primitives/SymmetricKey.js +20 -19
  7. package/dist/cjs/src/primitives/SymmetricKey.js.map +1 -1
  8. package/dist/cjs/src/primitives/hex.js +1 -3
  9. package/dist/cjs/src/primitives/hex.js.map +1 -1
  10. package/dist/cjs/src/primitives/utils.js +10 -0
  11. package/dist/cjs/src/primitives/utils.js.map +1 -1
  12. package/dist/cjs/src/totp/totp.js +3 -1
  13. package/dist/cjs/src/totp/totp.js.map +1 -1
  14. package/dist/cjs/src/wallet/ProtoWallet.js +4 -2
  15. package/dist/cjs/src/wallet/ProtoWallet.js.map +1 -1
  16. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  17. package/dist/esm/src/primitives/AESGCM.js +158 -75
  18. package/dist/esm/src/primitives/AESGCM.js.map +1 -1
  19. package/dist/esm/src/primitives/Point.js +41 -18
  20. package/dist/esm/src/primitives/Point.js.map +1 -1
  21. package/dist/esm/src/primitives/SymmetricKey.js +20 -19
  22. package/dist/esm/src/primitives/SymmetricKey.js.map +1 -1
  23. package/dist/esm/src/primitives/hex.js +1 -3
  24. package/dist/esm/src/primitives/hex.js.map +1 -1
  25. package/dist/esm/src/primitives/utils.js +9 -0
  26. package/dist/esm/src/primitives/utils.js.map +1 -1
  27. package/dist/esm/src/totp/totp.js +3 -1
  28. package/dist/esm/src/totp/totp.js.map +1 -1
  29. package/dist/esm/src/wallet/ProtoWallet.js +4 -2
  30. package/dist/esm/src/wallet/ProtoWallet.js.map +1 -1
  31. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  32. package/dist/types/src/primitives/AESGCM.d.ts +59 -9
  33. package/dist/types/src/primitives/AESGCM.d.ts.map +1 -1
  34. package/dist/types/src/primitives/Point.d.ts +1 -0
  35. package/dist/types/src/primitives/Point.d.ts.map +1 -1
  36. package/dist/types/src/primitives/SymmetricKey.d.ts.map +1 -1
  37. package/dist/types/src/primitives/hex.d.ts.map +1 -1
  38. package/dist/types/src/primitives/utils.d.ts +1 -0
  39. package/dist/types/src/primitives/utils.d.ts.map +1 -1
  40. package/dist/types/src/totp/totp.d.ts.map +1 -1
  41. package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
  42. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  43. package/dist/umd/bundle.js +3 -3
  44. package/dist/umd/bundle.js.map +1 -1
  45. package/docs/reference/primitives.md +206 -60
  46. package/package.json +1 -1
  47. package/src/primitives/AESGCM.ts +225 -103
  48. package/src/primitives/Point.ts +67 -20
  49. package/src/primitives/SymmetricKey.ts +28 -20
  50. package/src/primitives/__tests/AESGCM.test.ts +254 -354
  51. package/src/primitives/__tests/ECDSA.test.ts +27 -0
  52. package/src/primitives/__tests/Point.test.ts +52 -0
  53. package/src/primitives/__tests/utils.test.ts +24 -1
  54. package/src/primitives/hex.ts +1 -3
  55. package/src/primitives/utils.ts +10 -0
  56. package/src/totp/__tests/totp.test.ts +21 -0
  57. package/src/totp/totp.ts +9 -1
  58. package/src/wallet/ProtoWallet.ts +8 -3
  59. package/src/wallet/__tests/ProtoWallet.test.ts +55 -34
@@ -1756,6 +1756,7 @@ export default class Point extends BasePoint {
1756
1756
  x: BigNumber | null;
1757
1757
  y: BigNumber | null;
1758
1758
  inf: boolean;
1759
+ static _assertOnCurve(p: Point): Point
1759
1760
  static fromDER(bytes: number[]): Point
1760
1761
  static fromString(str: string): Point
1761
1762
  static fromX(x: BigNumber | number | number[] | string, odd: boolean): Point
@@ -4958,20 +4959,16 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
4958
4959
  ---
4959
4960
  ## Functions
4960
4961
 
4961
- | |
4962
- | --- |
4963
- | [AES](#function-aes) |
4964
- | [AESGCM](#function-aesgcm) |
4965
- | [AESGCMDecrypt](#function-aesgcmdecrypt) |
4966
- | [assertValidHex](#function-assertvalidhex) |
4967
- | [base64ToArray](#function-base64toarray) |
4968
- | [ghash](#function-ghash) |
4969
- | [normalizeHex](#function-normalizehex) |
4970
- | [pbkdf2](#function-pbkdf2) |
4971
- | [red](#function-red) |
4972
- | [toArray](#function-toarray) |
4973
- | [toBase64](#function-tobase64) |
4974
- | [verifyNotNull](#function-verifynotnull) |
4962
+ | | |
4963
+ | --- | --- |
4964
+ | [AES](#function-aes) | [pbkdf2](#function-pbkdf2) |
4965
+ | [AESGCM](#function-aesgcm) | [realHtonl](#function-realhtonl) |
4966
+ | [AESGCMDecrypt](#function-aesgcmdecrypt) | [red](#function-red) |
4967
+ | [assertValidHex](#function-assertvalidhex) | [swapBytes32](#function-swapbytes32) |
4968
+ | [base64ToArray](#function-base64toarray) | [toArray](#function-toarray) |
4969
+ | [ghash](#function-ghash) | [toBase64](#function-tobase64) |
4970
+ | [htonl](#function-htonl) | [verifyNotNull](#function-verifynotnull) |
4971
+ | [normalizeHex](#function-normalizehex) | |
4975
4972
 
4976
4973
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
4977
4974
 
@@ -4988,10 +4985,56 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
4988
4985
  ---
4989
4986
  ### Function: AESGCM
4990
4987
 
4991
- ```ts
4992
- export function AESGCM(plainText: number[], additionalAuthenticatedData: number[], initializationVector: number[], key: number[]): {
4993
- result: number[];
4994
- authenticationTag: number[];
4988
+ SECURITY NOTE – NON-STANDARD AES-GCM PADDING
4989
+
4990
+ This implementation intentionally deviates from NIST SP 800-38D’s AES-GCM
4991
+ specification in how the GHASH input is formed when the additional
4992
+ authenticated data (AAD) or ciphertext length is zero.
4993
+
4994
+ In the standard, AAD and ciphertext are each padded with the minimum number
4995
+ of zero bytes required to reach a multiple of 16 bytes; when the length is
4996
+ already a multiple of 16 (including the case length = 0), no padding block
4997
+ is added. In this implementation, when AAD.length === 0 or ciphertext.length
4998
+ === 0, an extra 16-byte block of zeros is appended before the length fields
4999
+ are processed. The same formatting logic is used symmetrically in both
5000
+ AESGCM (encryption) and AESGCMDecrypt (decryption).
5001
+
5002
+ As a result:
5003
+ - Authentication tags produced here are NOT compatible with tags produced
5004
+ by standards-compliant AES-GCM implementations in the cases where AAD
5005
+ or ciphertext are empty.
5006
+ - Ciphertexts generated by this code must be decrypted by this exact
5007
+ implementation (or one that reproduces the same GHASH formatting), and
5008
+ must not be mixed with ciphertexts produced by a strictly standard
5009
+ AES-GCM library.
5010
+
5011
+ Cryptographic impact: this change alters only the encoding of the message
5012
+ that is input to GHASH; it does not change the block cipher, key derivation,
5013
+ IV handling, or the basic “encrypt-then-MAC over (AAD, ciphertext, lengths)”
5014
+ structure of AES-GCM. Under the usual assumptions that AES is a secure block
5015
+ cipher and GHASH with a secret subkey is a secure polynomial MAC, this
5016
+ variant continues to provide confidentiality and integrity for data encrypted
5017
+ and decrypted consistently with this implementation. We are not aware of any
5018
+ attack that exploits the presence of this extra zero block when AAD or
5019
+ ciphertext are empty.
5020
+
5021
+ However, this padding behavior is non-compliant with NIST SP 800-38D and has
5022
+ not been analyzed as extensively as standard AES-GCM. Code that requires
5023
+ strict standards compliance or interoperability with external AES-GCM
5024
+ implementations SHOULD NOT use this module as-is. Any future migration to a
5025
+ fully compliant AES-GCM encoding will require a compatibility strategy, as
5026
+ existing ciphertexts produced by this implementation will otherwise become
5027
+ undecryptable.
5028
+
5029
+ This non-standard padding behavior is retained intentionally for backward
5030
+ compatibility: existing ciphertexts in production were generated with this
5031
+ encoding, and changing it would render previously encrypted data
5032
+ undecryptable by newer versions of the library.
5033
+
5034
+ ```ts
5035
+ export function AESGCM(plainText: Bytes, initializationVector: Bytes, key: Bytes): {
5036
+ result: Bytes;
5037
+ authenticationTag: Bytes;
4995
5038
  }
4996
5039
  ```
4997
5040
 
@@ -5001,7 +5044,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5001
5044
  ### Function: AESGCMDecrypt
5002
5045
 
5003
5046
  ```ts
5004
- export function AESGCMDecrypt(cipherText: number[], additionalAuthenticatedData: number[], initializationVector: number[], authenticationTag: number[], key: number[]): number[] | null
5047
+ export function AESGCMDecrypt(cipherText: Bytes, initializationVector: Bytes, authenticationTag: Bytes, key: Bytes): Bytes | null
5005
5048
  ```
5006
5049
 
5007
5050
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
@@ -5028,7 +5071,16 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5028
5071
  ### Function: ghash
5029
5072
 
5030
5073
  ```ts
5031
- export function ghash(input: number[], hashSubKey: number[]): number[]
5074
+ export function ghash(input: Bytes, hashSubKey: Bytes): Bytes
5075
+ ```
5076
+
5077
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5078
+
5079
+ ---
5080
+ ### Function: htonl
5081
+
5082
+ ```ts
5083
+ export function htonl(w: number): number
5032
5084
  ```
5033
5085
 
5034
5086
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
@@ -5070,6 +5122,42 @@ Argument Details
5070
5122
 
5071
5123
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5072
5124
 
5125
+ ---
5126
+ ### Function: realHtonl
5127
+
5128
+ Converts a 32-bit unsigned integer from host byte order to network byte order.
5129
+
5130
+ Unlike the legacy `htonl()` implementation (which always swapped bytes),
5131
+ this function behaves like the traditional C `htonl()`:
5132
+
5133
+ - On **little-endian** machines → performs a byte swap.
5134
+ - On **big-endian** machines → returns the value unchanged.
5135
+
5136
+ This function is provided to resolve TOB-20, which identified that the
5137
+ previous `htonl()` implementation had a misleading name and did not match
5138
+ platform-dependent semantics.
5139
+
5140
+ Example
5141
+
5142
+ ```ts
5143
+ realHtonl(0x11223344) // → 0x44332211 on little-endian systems
5144
+ ```
5145
+
5146
+ ```ts
5147
+ export function realHtonl(w: number): number
5148
+ ```
5149
+
5150
+ Returns
5151
+
5152
+ The value converted to network byte order.
5153
+
5154
+ Argument Details
5155
+
5156
+ + **w**
5157
+ + A 32-bit unsigned integer.
5158
+
5159
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5160
+
5073
5161
  ---
5074
5162
  ### Function: red
5075
5163
 
@@ -5079,6 +5167,41 @@ export function red(x: bigint): bigint
5079
5167
 
5080
5168
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5081
5169
 
5170
+ ---
5171
+ ### Function: swapBytes32
5172
+
5173
+ Unconditionally swaps the byte order of a 32-bit unsigned integer.
5174
+
5175
+ This function performs a strict 32-bit byte swap regardless of host
5176
+ endianness. It is equivalent to the behavior commonly referred to as
5177
+ `bswap32` in low-level libraries.
5178
+
5179
+ This function is introduced as part of TOB-20 to provide a clearly-named
5180
+ alternative to `htonl()`, which was previously implemented as an
5181
+ unconditional byte swap and did not match the semantics of the traditional
5182
+ C `htonl()` function.
5183
+
5184
+ Example
5185
+
5186
+ ```ts
5187
+ swapBytes32(0x11223344) // → 0x44332211
5188
+ ```
5189
+
5190
+ ```ts
5191
+ export function swapBytes32(w: number): number
5192
+ ```
5193
+
5194
+ Returns
5195
+
5196
+ The value with its byte order reversed.
5197
+
5198
+ Argument Details
5199
+
5200
+ + **w**
5201
+ + A 32-bit unsigned integer.
5202
+
5203
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5204
+
5082
5205
  ---
5083
5206
  ### Function: toArray
5084
5207
 
@@ -5177,24 +5300,24 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5177
5300
 
5178
5301
  | | | |
5179
5302
  | --- | --- | --- |
5180
- | [BI_EIGHT](#variable-bi_eight) | [biModSqrt](#variable-bimodsqrt) | [multiply](#variable-multiply) |
5181
- | [BI_FOUR](#variable-bi_four) | [biModSub](#variable-bimodsub) | [rightShift](#variable-rightshift) |
5182
- | [BI_ONE](#variable-bi_one) | [checkBit](#variable-checkbit) | [ripemd160](#variable-ripemd160) |
5183
- | [BI_THREE](#variable-bi_three) | [encode](#variable-encode) | [scalarMultiplyWNAF](#variable-scalarmultiplywnaf) |
5184
- | [BI_TWO](#variable-bi_two) | [exclusiveOR](#variable-exclusiveor) | [sha1](#variable-sha1) |
5185
- | [BI_ZERO](#variable-bi_zero) | [fromBase58](#variable-frombase58) | [sha256](#variable-sha256) |
5186
- | [GX_BIGINT](#variable-gx_bigint) | [fromBase58Check](#variable-frombase58check) | [sha256hmac](#variable-sha256hmac) |
5187
- | [GY_BIGINT](#variable-gy_bigint) | [getBytes](#variable-getbytes) | [sha512](#variable-sha512) |
5188
- | [MASK_256](#variable-mask_256) | [hash160](#variable-hash160) | [sha512hmac](#variable-sha512hmac) |
5189
- | [N_BIGINT](#variable-n_bigint) | [hash256](#variable-hash256) | [sign](#variable-sign) |
5190
- | [P_BIGINT](#variable-p_bigint) | [incrementLeastSignificantThirtyTwoBits](#variable-incrementleastsignificantthirtytwobits) | [toArray](#variable-toarray) |
5191
- | [P_PLUS1_DIV4](#variable-p_plus1_div4) | [jpAdd](#variable-jpadd) | [toBase58](#variable-tobase58) |
5192
- | [biMod](#variable-bimod) | [jpDouble](#variable-jpdouble) | [toBase58Check](#variable-tobase58check) |
5193
- | [biModAdd](#variable-bimodadd) | [jpNeg](#variable-jpneg) | [toHex](#variable-tohex) |
5194
- | [biModInv](#variable-bimodinv) | [minimallyEncode](#variable-minimallyencode) | [toUTF8](#variable-toutf8) |
5195
- | [biModMul](#variable-bimodmul) | [modInvN](#variable-modinvn) | [verify](#variable-verify) |
5196
- | [biModPow](#variable-bimodpow) | [modMulN](#variable-modmuln) | [zero2](#variable-zero2) |
5197
- | [biModSqr](#variable-bimodsqr) | [modN](#variable-modn) | |
5303
+ | [BI_EIGHT](#variable-bi_eight) | [biModSqrt](#variable-bimodsqrt) | [modN](#variable-modn) |
5304
+ | [BI_FOUR](#variable-bi_four) | [biModSub](#variable-bimodsub) | [multiply](#variable-multiply) |
5305
+ | [BI_ONE](#variable-bi_one) | [checkBit](#variable-checkbit) | [rightShift](#variable-rightshift) |
5306
+ | [BI_THREE](#variable-bi_three) | [encode](#variable-encode) | [ripemd160](#variable-ripemd160) |
5307
+ | [BI_TWO](#variable-bi_two) | [exclusiveOR](#variable-exclusiveor) | [scalarMultiplyWNAF](#variable-scalarmultiplywnaf) |
5308
+ | [BI_ZERO](#variable-bi_zero) | [fromBase58](#variable-frombase58) | [sha1](#variable-sha1) |
5309
+ | [GX_BIGINT](#variable-gx_bigint) | [fromBase58Check](#variable-frombase58check) | [sha256](#variable-sha256) |
5310
+ | [GY_BIGINT](#variable-gy_bigint) | [getBytes](#variable-getbytes) | [sha256hmac](#variable-sha256hmac) |
5311
+ | [MASK_256](#variable-mask_256) | [getBytes64](#variable-getbytes64) | [sha512](#variable-sha512) |
5312
+ | [N_BIGINT](#variable-n_bigint) | [hash160](#variable-hash160) | [sha512hmac](#variable-sha512hmac) |
5313
+ | [P_BIGINT](#variable-p_bigint) | [hash256](#variable-hash256) | [sign](#variable-sign) |
5314
+ | [P_PLUS1_DIV4](#variable-p_plus1_div4) | [incrementLeastSignificantThirtyTwoBits](#variable-incrementleastsignificantthirtytwobits) | [toArray](#variable-toarray) |
5315
+ | [biMod](#variable-bimod) | [jpAdd](#variable-jpadd) | [toBase58](#variable-tobase58) |
5316
+ | [biModAdd](#variable-bimodadd) | [jpDouble](#variable-jpdouble) | [toBase58Check](#variable-tobase58check) |
5317
+ | [biModInv](#variable-bimodinv) | [jpNeg](#variable-jpneg) | [toHex](#variable-tohex) |
5318
+ | [biModMul](#variable-bimodmul) | [minimallyEncode](#variable-minimallyencode) | [toUTF8](#variable-toutf8) |
5319
+ | [biModPow](#variable-bimodpow) | [modInvN](#variable-modinvn) | [verify](#variable-verify) |
5320
+ | [biModSqr](#variable-bimodsqr) | [modMulN](#variable-modmuln) | [zero2](#variable-zero2) |
5198
5321
 
5199
5322
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5200
5323
 
@@ -5369,20 +5492,20 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5369
5492
 
5370
5493
  ```ts
5371
5494
  biModPow = (base: bigint, exp: bigint): bigint => {
5372
- let result = BI_ONE;
5495
+ let result = 1n;
5373
5496
  base = biMod(base);
5374
- let e = exp;
5375
- while (e > BI_ZERO) {
5376
- if ((e & BI_ONE) === BI_ONE)
5497
+ while (exp > 0n) {
5498
+ if ((exp & 1n) !== 0n) {
5377
5499
  result = biModMul(result, base);
5500
+ }
5378
5501
  base = biModMul(base, base);
5379
- e >>= BI_ONE;
5502
+ exp >>= 1n;
5380
5503
  }
5381
5504
  return result;
5382
5505
  }
5383
5506
  ```
5384
5507
 
5385
- See also: [BI_ONE](./primitives.md#variable-bi_one), [BI_ZERO](./primitives.md#variable-bi_zero), [biMod](./primitives.md#variable-bimod), [biModMul](./primitives.md#variable-bimodmul)
5508
+ See also: [biMod](./primitives.md#variable-bimod), [biModMul](./primitives.md#variable-bimodmul)
5386
5509
 
5387
5510
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5388
5511
 
@@ -5403,7 +5526,10 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5403
5526
  ```ts
5404
5527
  biModSqrt = (a: bigint): bigint | null => {
5405
5528
  const r = biModPow(a, P_PLUS1_DIV4);
5406
- return biModMul(r, r) === biMod(a) ? r : null;
5529
+ if (biModMul(r, r) !== biMod(a)) {
5530
+ return null;
5531
+ }
5532
+ return r;
5407
5533
  }
5408
5534
  ```
5409
5535
 
@@ -5457,11 +5583,11 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5457
5583
  ### Variable: exclusiveOR
5458
5584
 
5459
5585
  ```ts
5460
- exclusiveOR = function (block0: number[], block1: number[]): number[] {
5586
+ exclusiveOR = function (block0: Bytes, block1: Bytes): Bytes {
5461
5587
  const len = block0.length;
5462
- const result = new Array(len);
5588
+ const result = new Uint8Array(len);
5463
5589
  for (let i = 0; i < len; i++) {
5464
- result[i] = block0[i] ^ block1[i];
5590
+ result[i] = block0[i] ^ (block1[i] ?? 0);
5465
5591
  }
5466
5592
  return result;
5467
5593
  }
@@ -5551,6 +5677,31 @@ getBytes = function (numericValue: number): number[] {
5551
5677
 
5552
5678
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5553
5679
 
5680
+ ---
5681
+ ### Variable: getBytes64
5682
+
5683
+ ```ts
5684
+ getBytes64 = function (numericValue: number): number[] {
5685
+ if (numericValue < 0 || numericValue > Number.MAX_SAFE_INTEGER) {
5686
+ throw new Error("getBytes64: value out of range");
5687
+ }
5688
+ const hi = Math.floor(numericValue / 4294967296);
5689
+ const lo = numericValue >>> 0;
5690
+ return [
5691
+ (hi >>> 24) & 255,
5692
+ (hi >>> 16) & 255,
5693
+ (hi >>> 8) & 255,
5694
+ hi & 255,
5695
+ (lo >>> 24) & 255,
5696
+ (lo >>> 16) & 255,
5697
+ (lo >>> 8) & 255,
5698
+ lo & 255
5699
+ ];
5700
+ }
5701
+ ```
5702
+
5703
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Enums](#enums), [Variables](#variables)
5704
+
5554
5705
  ---
5555
5706
  ### Variable: hash160
5556
5707
 
@@ -5583,15 +5734,11 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5583
5734
  ### Variable: incrementLeastSignificantThirtyTwoBits
5584
5735
 
5585
5736
  ```ts
5586
- incrementLeastSignificantThirtyTwoBits = function (block: number[]): number[] {
5587
- let i;
5737
+ incrementLeastSignificantThirtyTwoBits = function (block: Bytes): Bytes {
5588
5738
  const result = block.slice();
5589
- for (i = 15; i !== 11; i--) {
5590
- result[i] = result[i] + 1;
5591
- if (result[i] === 256) {
5592
- result[i] = 0;
5593
- }
5594
- else {
5739
+ for (let i = 15; i !== 11; i--) {
5740
+ result[i] = (result[i] + 1) & 255;
5741
+ if (result[i] !== 0) {
5595
5742
  break;
5596
5743
  }
5597
5744
  }
@@ -5763,7 +5910,7 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5763
5910
  ### Variable: multiply
5764
5911
 
5765
5912
  ```ts
5766
- multiply = function (block0: number[], block1: number[]): number[] {
5913
+ multiply = function (block0: Bytes, block1: Bytes): Bytes {
5767
5914
  const v = block1.slice();
5768
5915
  const z = createZeroBlock(16);
5769
5916
  for (let i = 0; i < 16; i++) {
@@ -5792,11 +5939,10 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
5792
5939
  ### Variable: rightShift
5793
5940
 
5794
5941
  ```ts
5795
- rightShift = function (block: number[]): number[] {
5796
- let i: number;
5942
+ rightShift = function (block: Bytes): Bytes {
5797
5943
  let carry = 0;
5798
5944
  let oldCarry = 0;
5799
- for (i = 0; i < block.length; i++) {
5945
+ for (let i = 0; i < block.length; i++) {
5800
5946
  oldCarry = carry;
5801
5947
  carry = block[i] & 1;
5802
5948
  block[i] = block[i] >> 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.9.24",
3
+ "version": "1.9.29",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",