@stryke/hash 0.9.7 → 0.10.0

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/dist/hash.d.ts CHANGED
@@ -9,8 +9,8 @@ export interface HashOptions {
9
9
  /**
10
10
  * Hash any JS value into a string
11
11
  *
12
- * @param object - The value to hash
12
+ * @param content - The value to hash
13
13
  * @param options - Hashing options
14
14
  * @returns A hashed string value
15
15
  */
16
- export declare function hash(object: any, options?: HashOptions): string;
16
+ export declare function hash(content: any, options?: HashOptions): string;
package/dist/index.cjs CHANGED
@@ -25,6 +25,17 @@ Object.keys(_hashFiles).forEach(function (key) {
25
25
  }
26
26
  });
27
27
  });
28
+ var _md = require("./md5.cjs");
29
+ Object.keys(_md).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _md[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _md[key];
36
+ }
37
+ });
38
+ });
28
39
  var _sha = require("./sha-256.cjs");
29
40
  Object.keys(_sha).forEach(function (key) {
30
41
  if (key === "default" || key === "__esModule") return;
package/dist/index.d.ts CHANGED
@@ -8,5 +8,6 @@
8
8
  */
9
9
  export * from "./hash";
10
10
  export * from "./hash-files";
11
+ export * from "./md5";
11
12
  export * from "./sha-256";
12
13
  export * from "./xx-hash";
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export*from"./hash";export*from"./hash-files";export*from"./sha-256";export*from"./xx-hash";
1
+ export*from"./hash";export*from"./hash-files";export*from"./md5";export*from"./sha-256";export*from"./xx-hash";
package/dist/md5.cjs ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.md5 = md5;
7
+ var _nodeCrypto = require("node:crypto");
8
+ function md5(e, t = 32) {
9
+ return (0, _nodeCrypto.createHash)("md5").update(e).digest("hex").slice(0, t);
10
+ }
package/dist/md5.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generate an MD5 hash of the provided content.
3
+ *
4
+ * @param content - The content to hash.
5
+ * @param length - The length of the hash to return.
6
+ * @returns The generated MD5 hash.
7
+ */
8
+ export declare function md5(content: string, length?: number): string;
package/dist/md5.mjs ADDED
@@ -0,0 +1 @@
1
+ import{createHash as r}from"node:crypto";export function md5(e,t=32){return r("md5").update(e).digest("hex").slice(0,t)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/hash",
3
- "version": "0.9.7",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "A package containing utility functions that hash data using various algorithms.",
6
6
  "repository": {
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "js-xxhash": "^4.0.0",
14
14
  "ohash": "^2.0.11",
15
- "@stryke/fs": "^0.21.3"
15
+ "@stryke/fs": "^0.22.6"
16
16
  },
17
17
  "publishConfig": { "access": "public" },
18
18
  "devDependencies": {},
@@ -87,6 +87,11 @@
87
87
  "default": "./dist/sha-256.mjs"
88
88
  }
89
89
  },
90
+ "./md5": {
91
+ "import": { "types": "./dist/md5.d.ts", "default": "./dist/md5.mjs" },
92
+ "require": { "types": "./dist/md5.d.ts", "default": "./dist/md5.cjs" },
93
+ "default": { "types": "./dist/md5.d.ts", "default": "./dist/md5.mjs" }
94
+ },
90
95
  "./index": {
91
96
  "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
92
97
  "require": {
@@ -140,5 +145,6 @@
140
145
  },
141
146
  "main": "./dist/index.cjs",
142
147
  "module": "./dist/index.mjs",
143
- "types": "./dist/index.d.ts"
148
+ "types": "./dist/index.d.ts",
149
+ "gitHead": "ea7a3a1d68d4a4361cc04d6f5bf6219a5bc4a2a2"
144
150
  }