@blaxel/core 0.2.13 → 0.2.14-preview.22

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAlphanumericLimitedHash = getAlphanumericLimitedHash;
4
4
  exports.getGlobalUniqueHash = getGlobalUniqueHash;
5
5
  /* eslint-disable */
6
- // Pure JS MD5 implementation (public domain, compact)
6
+ // Pure JS MD5 implementation that matches standard crypto MD5
7
7
  function md5(input) {
8
8
  function cmn(q, a, b, x, s, t) {
9
9
  a = (((a + q) | 0) + ((x + t) | 0)) | 0;
@@ -121,10 +121,12 @@ function md5(input) {
121
121
  md5cycle(state, tail);
122
122
  return state;
123
123
  }
124
+ // Fixed hex conversion function
124
125
  function rhex(n) {
125
- let s = '', j = 0;
126
- for (; j < 4; j++)
127
- s += ('0' + ((n >> (j * 8 + 4)) & 0x0f).toString(16)).slice(-2) + ((n >> (j * 8)) & 0x0f).toString(16);
126
+ let s = '';
127
+ for (let j = 0; j < 4; j++) {
128
+ s += ((n >> (j * 8)) & 0xFF).toString(16).padStart(2, '0');
129
+ }
128
130
  return s;
129
131
  }
130
132
  return md51(input).map(rhex).join('');
@@ -5,16 +5,16 @@ const internal_1 = require("./internal");
5
5
  (0, vitest_1.describe)('getAlphanumericLimitedHash', () => {
6
6
  (0, vitest_1.it)('returns correct MD5 hash for a known string', () => {
7
7
  // MD5 of 'hello' is 5d41402abc4b2a76b9719d911017c592
8
- (0, vitest_1.expect)((0, internal_1.getAlphanumericLimitedHash)('hello')).toBe('05d04104002a0bc04b02a0760b907109d0910100170c5092');
8
+ (0, vitest_1.expect)((0, internal_1.getAlphanumericLimitedHash)('hello')).toBe('5d41402abc4b2a76b9719d911017c592');
9
9
  });
10
10
  (0, vitest_1.it)('respects the maxSize parameter', () => {
11
11
  const hash = (0, internal_1.getAlphanumericLimitedHash)('hello', 8);
12
12
  (0, vitest_1.expect)(hash.length).toBe(8);
13
- (0, vitest_1.expect)(hash).toBe('05d04104');
13
+ (0, vitest_1.expect)(hash).toBe('5d41402a');
14
14
  });
15
15
  (0, vitest_1.it)('returns full hash if maxSize is larger than hash', () => {
16
16
  const hash = (0, internal_1.getAlphanumericLimitedHash)('hello', 64);
17
- (0, vitest_1.expect)(hash).toBe('05d04104002a0bc04b02a0760b907109d0910100170c5092');
17
+ (0, vitest_1.expect)(hash).toBe('5d41402abc4b2a76b9719d911017c592');
18
18
  });
19
19
  });
20
20
  (0, vitest_1.describe)('getGlobalUniqueHash', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.13",
3
+ "version": "0.2.14-preview.22",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",