tinyhmacmd5 0.1.4 → 0.1.5

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 (3) hide show
  1. package/main.d.ts +9 -4
  2. package/main.js +1 -15
  3. package/package.json +1 -1
package/main.d.ts CHANGED
@@ -4,10 +4,10 @@
4
4
  * By default, returns the hash as a lowercase hexadecimal string.
5
5
  * If `raw` is true, returns a Uint8Array.
6
6
  *
7
- * @param {string | Uint8Array | Uint8ClampedArray} data The input data to hash. Strings are UTF‑8 encoded.
8
- * @param {string | Uint8Array | Uint8ClampedArray | null} [key] Optional HMAC key. When given, HMAC‑MD5 is calculated instead of plain MD5.
9
- * @param {boolean} [raw] If true, the hash is returned as raw bytes (Uint8Array); otherwise, as a hex string.
10
- * @returns {string | Uint8Array<ArrayBuffer>} The MD5 (or HMAC‑MD5) digest, either as a hex string or a Uint8Array.
7
+ * @param data The input data to hash. Strings are UTF‑8 encoded.
8
+ * @param key Optional HMAC key. When given, HMAC‑MD5 is calculated instead of plain MD5.
9
+ * @param raw If true, the hash is returned as raw bytes (Uint8Array); otherwise, as a hex string.
10
+ * @returns The MD5 (or HMAC‑MD5) digest, either as a hex string or a Uint8Array.
11
11
  */
12
12
  declare var md5: {
13
13
  (
@@ -20,5 +20,10 @@ declare var md5: {
20
20
  key: string | Uint8Array | Uint8ClampedArray | null | undefined,
21
21
  raw: true
22
22
  ): Uint8Array<ArrayBuffer>;
23
+ (
24
+ data: string | Uint8Array | Uint8ClampedArray,
25
+ key: string | Uint8Array | Uint8ClampedArray | null | undefined,
26
+ raw: boolean
27
+ ): string | Uint8Array<ArrayBuffer>;
23
28
  };
24
29
  export default md5;
package/main.js CHANGED
@@ -20,7 +20,7 @@ let toBinlLen = (byteLen) => floor((byteLen + 8) / 64) * 16 + 16
20
20
  let K = []
21
21
 
22
22
  /**
23
- * Calculate the MD5 of an array of little-endian words, and a bit length.
23
+ * Calculate the MD5 of an array of little-endian words, and a byte length.
24
24
  *
25
25
  * @param {Int32Array | number[]} x Array of little-endian words
26
26
  * @param {number} l Byte length
@@ -124,20 +124,6 @@ let inputToBinl = (
124
124
  return [output, byteLen]
125
125
  }
126
126
 
127
- /**
128
- * @overload
129
- * @param {string | Uint8Array | Uint8ClampedArray} data
130
- * @param {string | Uint8Array | Uint8ClampedArray | null} [key]
131
- * @param {false} [raw]
132
- * @returns {string}
133
- */
134
- /**
135
- * @overload
136
- * @param {string | Uint8Array | Uint8ClampedArray} data
137
- * @param {string | Uint8Array | Uint8ClampedArray | null | undefined} key
138
- * @param {true} raw
139
- * @returns {Uint8Array<ArrayBuffer>}
140
- */
141
127
  /**
142
128
  * Computes the MD5 hash of the input data.
143
129
  * If a key is provided, computes HMAC-MD5.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinyhmacmd5",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A tiny, fully compliant HMAC-MD5 implementation for JavaScript: browser.min.js is only 1045 bytes.",
5
5
  "author": "bddjr",
6
6
  "license": "MIT",