gitx.do 0.1.0 → 0.1.2
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/README.md +40 -353
- package/dist/do/logger.d.ts +50 -0
- package/dist/do/logger.d.ts.map +1 -0
- package/dist/do/logger.js +122 -0
- package/dist/do/logger.js.map +1 -0
- package/dist/{durable-object → do}/schema.d.ts +3 -3
- package/dist/do/schema.d.ts.map +1 -0
- package/dist/{durable-object → do}/schema.js +4 -3
- package/dist/do/schema.js.map +1 -0
- package/dist/do/types.d.ts +267 -0
- package/dist/do/types.d.ts.map +1 -0
- package/dist/do/types.js +62 -0
- package/dist/do/types.js.map +1 -0
- package/dist/index.d.ts +15 -415
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -483
- package/dist/index.js.map +1 -1
- package/package.json +13 -21
- package/dist/cli/commands/add.d.ts +0 -174
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -131
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/blame.d.ts +0 -259
- package/dist/cli/commands/blame.d.ts.map +0 -1
- package/dist/cli/commands/blame.js +0 -609
- package/dist/cli/commands/blame.js.map +0 -1
- package/dist/cli/commands/branch.d.ts +0 -249
- package/dist/cli/commands/branch.d.ts.map +0 -1
- package/dist/cli/commands/branch.js +0 -693
- package/dist/cli/commands/branch.js.map +0 -1
- package/dist/cli/commands/commit.d.ts +0 -182
- package/dist/cli/commands/commit.d.ts.map +0 -1
- package/dist/cli/commands/commit.js +0 -437
- package/dist/cli/commands/commit.js.map +0 -1
- package/dist/cli/commands/diff.d.ts +0 -464
- package/dist/cli/commands/diff.d.ts.map +0 -1
- package/dist/cli/commands/diff.js +0 -958
- package/dist/cli/commands/diff.js.map +0 -1
- package/dist/cli/commands/log.d.ts +0 -239
- package/dist/cli/commands/log.d.ts.map +0 -1
- package/dist/cli/commands/log.js +0 -535
- package/dist/cli/commands/log.js.map +0 -1
- package/dist/cli/commands/merge.d.ts +0 -106
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -55
- package/dist/cli/commands/merge.js.map +0 -1
- package/dist/cli/commands/review.d.ts +0 -457
- package/dist/cli/commands/review.d.ts.map +0 -1
- package/dist/cli/commands/review.js +0 -533
- package/dist/cli/commands/review.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -269
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -493
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/web.d.ts +0 -199
- package/dist/cli/commands/web.d.ts.map +0 -1
- package/dist/cli/commands/web.js +0 -696
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/cli/fs-adapter.d.ts +0 -656
- package/dist/cli/fs-adapter.d.ts.map +0 -1
- package/dist/cli/fs-adapter.js +0 -1179
- package/dist/cli/fs-adapter.js.map +0 -1
- package/dist/cli/fsx-cli-adapter.d.ts +0 -359
- package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
- package/dist/cli/fsx-cli-adapter.js +0 -619
- package/dist/cli/fsx-cli-adapter.js.map +0 -1
- package/dist/cli/index.d.ts +0 -387
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -523
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/ui/components/DiffView.d.ts +0 -7
- package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
- package/dist/cli/ui/components/DiffView.js +0 -11
- package/dist/cli/ui/components/DiffView.js.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -6
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.js +0 -11
- package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.d.ts +0 -9
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.js +0 -12
- package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -6
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.js +0 -10
- package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
- package/dist/cli/ui/components/NavigationList.d.ts +0 -9
- package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
- package/dist/cli/ui/components/NavigationList.js +0 -11
- package/dist/cli/ui/components/NavigationList.js.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.d.ts +0 -8
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.js +0 -11
- package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
- package/dist/cli/ui/components/index.d.ts +0 -7
- package/dist/cli/ui/components/index.d.ts.map +0 -1
- package/dist/cli/ui/components/index.js +0 -9
- package/dist/cli/ui/components/index.js.map +0 -1
- package/dist/cli/ui/terminal-ui.d.ts +0 -52
- package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
- package/dist/cli/ui/terminal-ui.js +0 -121
- package/dist/cli/ui/terminal-ui.js.map +0 -1
- package/dist/do/BashModule.d.ts +0 -871
- package/dist/do/BashModule.d.ts.map +0 -1
- package/dist/do/BashModule.js +0 -1143
- package/dist/do/BashModule.js.map +0 -1
- package/dist/do/FsModule.d.ts +0 -601
- package/dist/do/FsModule.d.ts.map +0 -1
- package/dist/do/FsModule.js +0 -1120
- package/dist/do/FsModule.js.map +0 -1
- package/dist/do/GitModule.d.ts +0 -635
- package/dist/do/GitModule.d.ts.map +0 -1
- package/dist/do/GitModule.js +0 -781
- package/dist/do/GitModule.js.map +0 -1
- package/dist/do/GitRepoDO.d.ts +0 -281
- package/dist/do/GitRepoDO.d.ts.map +0 -1
- package/dist/do/GitRepoDO.js +0 -479
- package/dist/do/GitRepoDO.js.map +0 -1
- package/dist/do/bash-ast.d.ts +0 -246
- package/dist/do/bash-ast.d.ts.map +0 -1
- package/dist/do/bash-ast.js +0 -888
- package/dist/do/bash-ast.js.map +0 -1
- package/dist/do/container-executor.d.ts +0 -491
- package/dist/do/container-executor.d.ts.map +0 -1
- package/dist/do/container-executor.js +0 -730
- package/dist/do/container-executor.js.map +0 -1
- package/dist/do/index.d.ts +0 -53
- package/dist/do/index.d.ts.map +0 -1
- package/dist/do/index.js +0 -91
- package/dist/do/index.js.map +0 -1
- package/dist/do/tiered-storage.d.ts +0 -403
- package/dist/do/tiered-storage.d.ts.map +0 -1
- package/dist/do/tiered-storage.js +0 -689
- package/dist/do/tiered-storage.js.map +0 -1
- package/dist/do/withBash.d.ts +0 -231
- package/dist/do/withBash.d.ts.map +0 -1
- package/dist/do/withBash.js +0 -244
- package/dist/do/withBash.js.map +0 -1
- package/dist/do/withFs.d.ts +0 -237
- package/dist/do/withFs.d.ts.map +0 -1
- package/dist/do/withFs.js +0 -387
- package/dist/do/withFs.js.map +0 -1
- package/dist/do/withGit.d.ts +0 -180
- package/dist/do/withGit.d.ts.map +0 -1
- package/dist/do/withGit.js +0 -271
- package/dist/do/withGit.js.map +0 -1
- package/dist/durable-object/object-store.d.ts +0 -633
- package/dist/durable-object/object-store.d.ts.map +0 -1
- package/dist/durable-object/object-store.js +0 -1161
- package/dist/durable-object/object-store.js.map +0 -1
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/durable-object/wal.d.ts +0 -416
- package/dist/durable-object/wal.d.ts.map +0 -1
- package/dist/durable-object/wal.js +0 -445
- package/dist/durable-object/wal.js.map +0 -1
- package/dist/mcp/adapter.d.ts +0 -772
- package/dist/mcp/adapter.d.ts.map +0 -1
- package/dist/mcp/adapter.js +0 -895
- package/dist/mcp/adapter.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
- package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.js +0 -30
- package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -17
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -71
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox.d.ts +0 -764
- package/dist/mcp/sandbox.d.ts.map +0 -1
- package/dist/mcp/sandbox.js +0 -1362
- package/dist/mcp/sandbox.js.map +0 -1
- package/dist/mcp/sdk-adapter.d.ts +0 -835
- package/dist/mcp/sdk-adapter.d.ts.map +0 -1
- package/dist/mcp/sdk-adapter.js +0 -974
- package/dist/mcp/sdk-adapter.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -32
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -115
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -548
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1934
- package/dist/mcp/tools.js.map +0 -1
- package/dist/ops/blame.d.ts +0 -551
- package/dist/ops/blame.d.ts.map +0 -1
- package/dist/ops/blame.js +0 -1037
- package/dist/ops/blame.js.map +0 -1
- package/dist/ops/branch.d.ts +0 -766
- package/dist/ops/branch.d.ts.map +0 -1
- package/dist/ops/branch.js +0 -950
- package/dist/ops/branch.js.map +0 -1
- package/dist/ops/commit-traversal.d.ts +0 -349
- package/dist/ops/commit-traversal.d.ts.map +0 -1
- package/dist/ops/commit-traversal.js +0 -821
- package/dist/ops/commit-traversal.js.map +0 -1
- package/dist/ops/commit.d.ts +0 -555
- package/dist/ops/commit.d.ts.map +0 -1
- package/dist/ops/commit.js +0 -826
- package/dist/ops/commit.js.map +0 -1
- package/dist/ops/merge-base.d.ts +0 -397
- package/dist/ops/merge-base.d.ts.map +0 -1
- package/dist/ops/merge-base.js +0 -691
- package/dist/ops/merge-base.js.map +0 -1
- package/dist/ops/merge.d.ts +0 -855
- package/dist/ops/merge.d.ts.map +0 -1
- package/dist/ops/merge.js +0 -1551
- package/dist/ops/merge.js.map +0 -1
- package/dist/ops/tag.d.ts +0 -247
- package/dist/ops/tag.d.ts.map +0 -1
- package/dist/ops/tag.js +0 -649
- package/dist/ops/tag.js.map +0 -1
- package/dist/ops/tree-builder.d.ts +0 -178
- package/dist/ops/tree-builder.d.ts.map +0 -1
- package/dist/ops/tree-builder.js +0 -271
- package/dist/ops/tree-builder.js.map +0 -1
- package/dist/ops/tree-diff.d.ts +0 -291
- package/dist/ops/tree-diff.d.ts.map +0 -1
- package/dist/ops/tree-diff.js +0 -705
- package/dist/ops/tree-diff.js.map +0 -1
- package/dist/pack/delta.d.ts +0 -248
- package/dist/pack/delta.d.ts.map +0 -1
- package/dist/pack/delta.js +0 -736
- package/dist/pack/delta.js.map +0 -1
- package/dist/pack/format.d.ts +0 -446
- package/dist/pack/format.d.ts.map +0 -1
- package/dist/pack/format.js +0 -572
- package/dist/pack/format.js.map +0 -1
- package/dist/pack/full-generation.d.ts +0 -612
- package/dist/pack/full-generation.d.ts.map +0 -1
- package/dist/pack/full-generation.js +0 -1378
- package/dist/pack/full-generation.js.map +0 -1
- package/dist/pack/generation.d.ts +0 -441
- package/dist/pack/generation.d.ts.map +0 -1
- package/dist/pack/generation.js +0 -707
- package/dist/pack/generation.js.map +0 -1
- package/dist/pack/index.d.ts +0 -502
- package/dist/pack/index.d.ts.map +0 -1
- package/dist/pack/index.js +0 -833
- package/dist/pack/index.js.map +0 -1
- package/dist/refs/branch.d.ts +0 -668
- package/dist/refs/branch.d.ts.map +0 -1
- package/dist/refs/branch.js +0 -897
- package/dist/refs/branch.js.map +0 -1
- package/dist/refs/storage.d.ts +0 -833
- package/dist/refs/storage.d.ts.map +0 -1
- package/dist/refs/storage.js +0 -1023
- package/dist/refs/storage.js.map +0 -1
- package/dist/refs/tag.d.ts +0 -860
- package/dist/refs/tag.d.ts.map +0 -1
- package/dist/refs/tag.js +0 -996
- package/dist/refs/tag.js.map +0 -1
- package/dist/storage/backend.d.ts +0 -425
- package/dist/storage/backend.d.ts.map +0 -1
- package/dist/storage/backend.js +0 -41
- package/dist/storage/backend.js.map +0 -1
- package/dist/storage/fsx-adapter.d.ts +0 -204
- package/dist/storage/fsx-adapter.d.ts.map +0 -1
- package/dist/storage/fsx-adapter.js +0 -470
- package/dist/storage/fsx-adapter.js.map +0 -1
- package/dist/storage/lru-cache.d.ts +0 -691
- package/dist/storage/lru-cache.d.ts.map +0 -1
- package/dist/storage/lru-cache.js +0 -813
- package/dist/storage/lru-cache.js.map +0 -1
- package/dist/storage/object-index.d.ts +0 -585
- package/dist/storage/object-index.d.ts.map +0 -1
- package/dist/storage/object-index.js +0 -532
- package/dist/storage/object-index.js.map +0 -1
- package/dist/storage/r2-pack.d.ts +0 -1257
- package/dist/storage/r2-pack.d.ts.map +0 -1
- package/dist/storage/r2-pack.js +0 -1770
- package/dist/storage/r2-pack.js.map +0 -1
- package/dist/tiered/cdc-pipeline.d.ts +0 -1888
- package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
- package/dist/tiered/cdc-pipeline.js +0 -1880
- package/dist/tiered/cdc-pipeline.js.map +0 -1
- package/dist/tiered/migration.d.ts +0 -1104
- package/dist/tiered/migration.d.ts.map +0 -1
- package/dist/tiered/migration.js +0 -1214
- package/dist/tiered/migration.js.map +0 -1
- package/dist/tiered/parquet-writer.d.ts +0 -1145
- package/dist/tiered/parquet-writer.d.ts.map +0 -1
- package/dist/tiered/parquet-writer.js +0 -1183
- package/dist/tiered/parquet-writer.js.map +0 -1
- package/dist/tiered/read-path.d.ts +0 -835
- package/dist/tiered/read-path.d.ts.map +0 -1
- package/dist/tiered/read-path.js +0 -487
- package/dist/tiered/read-path.js.map +0 -1
- package/dist/types/capability.d.ts +0 -1385
- package/dist/types/capability.d.ts.map +0 -1
- package/dist/types/capability.js +0 -36
- package/dist/types/capability.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +0 -1
- package/dist/types/objects.d.ts +0 -692
- package/dist/types/objects.d.ts.map +0 -1
- package/dist/types/objects.js +0 -837
- package/dist/types/objects.js.map +0 -1
- package/dist/types/storage.d.ts +0 -603
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js +0 -191
- package/dist/types/storage.js.map +0 -1
- package/dist/types/worker-loader.d.ts +0 -60
- package/dist/types/worker-loader.d.ts.map +0 -1
- package/dist/types/worker-loader.js +0 -62
- package/dist/types/worker-loader.js.map +0 -1
- package/dist/utils/hash.d.ts +0 -197
- package/dist/utils/hash.d.ts.map +0 -1
- package/dist/utils/hash.js +0 -268
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/sha1.d.ts +0 -290
- package/dist/utils/sha1.d.ts.map +0 -1
- package/dist/utils/sha1.js +0 -582
- package/dist/utils/sha1.js.map +0 -1
- package/dist/wire/capabilities.d.ts +0 -1044
- package/dist/wire/capabilities.d.ts.map +0 -1
- package/dist/wire/capabilities.js +0 -941
- package/dist/wire/capabilities.js.map +0 -1
- package/dist/wire/path-security.d.ts +0 -157
- package/dist/wire/path-security.d.ts.map +0 -1
- package/dist/wire/path-security.js +0 -307
- package/dist/wire/path-security.js.map +0 -1
- package/dist/wire/pkt-line.d.ts +0 -345
- package/dist/wire/pkt-line.d.ts.map +0 -1
- package/dist/wire/pkt-line.js +0 -381
- package/dist/wire/pkt-line.js.map +0 -1
- package/dist/wire/receive-pack.d.ts +0 -1059
- package/dist/wire/receive-pack.d.ts.map +0 -1
- package/dist/wire/receive-pack.js +0 -1414
- package/dist/wire/receive-pack.js.map +0 -1
- package/dist/wire/smart-http.d.ts +0 -799
- package/dist/wire/smart-http.d.ts.map +0 -1
- package/dist/wire/smart-http.js +0 -945
- package/dist/wire/smart-http.js.map +0 -1
- package/dist/wire/upload-pack.d.ts +0 -727
- package/dist/wire/upload-pack.d.ts.map +0 -1
- package/dist/wire/upload-pack.js +0 -1138
- package/dist/wire/upload-pack.js.map +0 -1
package/dist/utils/sha1.js
DELETED
|
@@ -1,582 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Synchronous SHA-1 Utilities for Git Pack Operations
|
|
3
|
-
*
|
|
4
|
-
* This module provides synchronous (non-async) SHA-1 hashing needed for pack file
|
|
5
|
-
* generation, verification, and streaming operations where async is impractical.
|
|
6
|
-
*
|
|
7
|
-
* The implementation follows the SHA-1 specification (FIPS 180-4) and processes
|
|
8
|
-
* data in 512-bit (64-byte) chunks using the standard compression function.
|
|
9
|
-
*
|
|
10
|
-
* **When to use this vs hash.ts**:
|
|
11
|
-
* - Use `utils/hash.ts` for general async hashing (uses Web Crypto API)
|
|
12
|
-
* - Use this module for pack operations that need synchronous hashing
|
|
13
|
-
*
|
|
14
|
-
* @module utils/sha1
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { sha1, sha1Hex, sha1Verify } from './utils/sha1'
|
|
19
|
-
*
|
|
20
|
-
* // Compute SHA-1 as bytes
|
|
21
|
-
* const data = new TextEncoder().encode('Hello, World!')
|
|
22
|
-
* const hashBytes = sha1(data) // 20-byte Uint8Array
|
|
23
|
-
*
|
|
24
|
-
* // Compute SHA-1 as hex string
|
|
25
|
-
* const hashHex = sha1Hex(data) // 40-char string
|
|
26
|
-
*
|
|
27
|
-
* // Verify data against expected hash
|
|
28
|
-
* const isValid = sha1Verify(data, expectedHash)
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* Compute SHA-1 hash of data synchronously.
|
|
33
|
-
*
|
|
34
|
-
* @description
|
|
35
|
-
* Implements the SHA-1 algorithm per FIPS 180-4. This pure JavaScript
|
|
36
|
-
* implementation is used when synchronous hashing is needed, such as
|
|
37
|
-
* in pack file generation or streaming operations.
|
|
38
|
-
*
|
|
39
|
-
* **Algorithm Details**:
|
|
40
|
-
* 1. Pad message to 512-bit boundary (with 1-bit, zeros, and 64-bit length)
|
|
41
|
-
* 2. Process in 64-byte chunks using 80-round compression function
|
|
42
|
-
* 3. Return final 160-bit (20-byte) hash
|
|
43
|
-
*
|
|
44
|
-
* **Performance Note**: This is slower than Web Crypto API. Use `hash.ts`
|
|
45
|
-
* for async operations where performance is critical.
|
|
46
|
-
*
|
|
47
|
-
* @param data - Input data to hash
|
|
48
|
-
* @returns 20-byte hash as Uint8Array
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```typescript
|
|
52
|
-
* const data = new TextEncoder().encode('test')
|
|
53
|
-
* const hash = sha1(data)
|
|
54
|
-
* console.log(hash.length) // 20
|
|
55
|
-
*
|
|
56
|
-
* // Use with pack file verification
|
|
57
|
-
* const packData = readPackFile()
|
|
58
|
-
* const computedHash = sha1(packData.slice(0, -20))
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export function sha1(data) {
|
|
62
|
-
/**
|
|
63
|
-
* Rotate left (circular left shift) operation.
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
function rotl(n, s) {
|
|
67
|
-
return ((n << s) | (n >>> (32 - s))) >>> 0;
|
|
68
|
-
}
|
|
69
|
-
// Initialize hash values (first 32 bits of fractional parts of square roots of first 5 primes)
|
|
70
|
-
let h0 = 0x67452301;
|
|
71
|
-
let h1 = 0xefcdab89;
|
|
72
|
-
let h2 = 0x98badcfe;
|
|
73
|
-
let h3 = 0x10325476;
|
|
74
|
-
let h4 = 0xc3d2e1f0;
|
|
75
|
-
// Pre-processing: add padding
|
|
76
|
-
const msgLen = data.length;
|
|
77
|
-
const bitLen = BigInt(msgLen) * 8n;
|
|
78
|
-
// Message needs to be padded to 64-byte boundary (512 bits)
|
|
79
|
-
// Padding: 1 bit (0x80), then zeros, then 64-bit length
|
|
80
|
-
const paddingLength = (64 - ((msgLen + 9) % 64)) % 64;
|
|
81
|
-
const paddedLen = msgLen + 1 + paddingLength + 8;
|
|
82
|
-
const padded = new Uint8Array(paddedLen);
|
|
83
|
-
padded.set(data, 0);
|
|
84
|
-
padded[msgLen] = 0x80;
|
|
85
|
-
// Write length as 64-bit big-endian at the end
|
|
86
|
-
const lengthView = new DataView(padded.buffer);
|
|
87
|
-
lengthView.setBigUint64(paddedLen - 8, bitLen, false);
|
|
88
|
-
// Process in 64-byte (512-bit) chunks
|
|
89
|
-
const w = new Uint32Array(80);
|
|
90
|
-
for (let chunkStart = 0; chunkStart < paddedLen; chunkStart += 64) {
|
|
91
|
-
const chunkView = new DataView(padded.buffer, chunkStart, 64);
|
|
92
|
-
// Break chunk into sixteen 32-bit big-endian words
|
|
93
|
-
for (let i = 0; i < 16; i++) {
|
|
94
|
-
w[i] = chunkView.getUint32(i * 4, false);
|
|
95
|
-
}
|
|
96
|
-
// Extend the sixteen 32-bit words into eighty 32-bit words
|
|
97
|
-
for (let i = 16; i < 80; i++) {
|
|
98
|
-
w[i] = rotl(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1);
|
|
99
|
-
}
|
|
100
|
-
// Initialize working variables
|
|
101
|
-
let a = h0;
|
|
102
|
-
let b = h1;
|
|
103
|
-
let c = h2;
|
|
104
|
-
let d = h3;
|
|
105
|
-
let e = h4;
|
|
106
|
-
// Main loop - 80 rounds
|
|
107
|
-
for (let i = 0; i < 80; i++) {
|
|
108
|
-
let f, k;
|
|
109
|
-
if (i < 20) {
|
|
110
|
-
// Round 0-19: Ch(b,c,d) = (b AND c) XOR (NOT b AND d)
|
|
111
|
-
f = (b & c) | (~b & d);
|
|
112
|
-
k = 0x5a827999;
|
|
113
|
-
}
|
|
114
|
-
else if (i < 40) {
|
|
115
|
-
// Round 20-39: Parity(b,c,d) = b XOR c XOR d
|
|
116
|
-
f = b ^ c ^ d;
|
|
117
|
-
k = 0x6ed9eba1;
|
|
118
|
-
}
|
|
119
|
-
else if (i < 60) {
|
|
120
|
-
// Round 40-59: Maj(b,c,d) = (b AND c) XOR (b AND d) XOR (c AND d)
|
|
121
|
-
f = (b & c) | (b & d) | (c & d);
|
|
122
|
-
k = 0x8f1bbcdc;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
// Round 60-79: Parity(b,c,d) = b XOR c XOR d
|
|
126
|
-
f = b ^ c ^ d;
|
|
127
|
-
k = 0xca62c1d6;
|
|
128
|
-
}
|
|
129
|
-
const temp = (rotl(a, 5) + f + e + k + w[i]) >>> 0;
|
|
130
|
-
e = d;
|
|
131
|
-
d = c;
|
|
132
|
-
c = rotl(b, 30);
|
|
133
|
-
b = a;
|
|
134
|
-
a = temp;
|
|
135
|
-
}
|
|
136
|
-
// Add this chunk's hash to result so far
|
|
137
|
-
h0 = (h0 + a) >>> 0;
|
|
138
|
-
h1 = (h1 + b) >>> 0;
|
|
139
|
-
h2 = (h2 + c) >>> 0;
|
|
140
|
-
h3 = (h3 + d) >>> 0;
|
|
141
|
-
h4 = (h4 + e) >>> 0;
|
|
142
|
-
}
|
|
143
|
-
// Produce the final hash value (big-endian)
|
|
144
|
-
const result = new Uint8Array(20);
|
|
145
|
-
const resultView = new DataView(result.buffer);
|
|
146
|
-
resultView.setUint32(0, h0, false);
|
|
147
|
-
resultView.setUint32(4, h1, false);
|
|
148
|
-
resultView.setUint32(8, h2, false);
|
|
149
|
-
resultView.setUint32(12, h3, false);
|
|
150
|
-
resultView.setUint32(16, h4, false);
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Compute SHA-1 hash and return as hexadecimal string.
|
|
155
|
-
*
|
|
156
|
-
* @description
|
|
157
|
-
* Convenience wrapper that computes SHA-1 and converts the result
|
|
158
|
-
* to a lowercase hexadecimal string. Equivalent to calling `sha1()`
|
|
159
|
-
* followed by hex conversion.
|
|
160
|
-
*
|
|
161
|
-
* @param data - Input data to hash
|
|
162
|
-
* @returns 40-character lowercase hexadecimal hash string
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* const data = new TextEncoder().encode('hello')
|
|
167
|
-
* const hex = sha1Hex(data)
|
|
168
|
-
* console.log(hex) // 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
|
|
169
|
-
*
|
|
170
|
-
* // Compare with git:
|
|
171
|
-
* // $ echo -n "hello" | sha1sum
|
|
172
|
-
* // aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
175
|
-
export function sha1Hex(data) {
|
|
176
|
-
const hash = sha1(data);
|
|
177
|
-
let hex = '';
|
|
178
|
-
for (let i = 0; i < hash.length; i++) {
|
|
179
|
-
hex += hash[i].toString(16).padStart(2, '0');
|
|
180
|
-
}
|
|
181
|
-
return hex;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Verify data against an expected SHA-1 hash.
|
|
185
|
-
*
|
|
186
|
-
* @description
|
|
187
|
-
* Computes the SHA-1 hash of the data and compares it byte-by-byte
|
|
188
|
-
* with the expected hash. Returns true only if all 20 bytes match.
|
|
189
|
-
*
|
|
190
|
-
* This uses constant-time comparison to avoid timing attacks,
|
|
191
|
-
* though SHA-1 is not used for security purposes in Git.
|
|
192
|
-
*
|
|
193
|
-
* @param data - Data to verify
|
|
194
|
-
* @param expected - Expected 20-byte SHA-1 hash
|
|
195
|
-
* @returns True if the computed hash matches the expected hash
|
|
196
|
-
* @throws Never throws - returns false for invalid inputs
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* ```typescript
|
|
200
|
-
* // Verify pack file integrity
|
|
201
|
-
* const packContent = readPackFile()
|
|
202
|
-
* const contentWithoutChecksum = packContent.slice(0, -20)
|
|
203
|
-
* const expectedChecksum = packContent.slice(-20)
|
|
204
|
-
*
|
|
205
|
-
* if (sha1Verify(contentWithoutChecksum, expectedChecksum)) {
|
|
206
|
-
* console.log('Pack file integrity verified')
|
|
207
|
-
* } else {
|
|
208
|
-
* console.log('Pack file corrupted!')
|
|
209
|
-
* }
|
|
210
|
-
*
|
|
211
|
-
* // Invalid expected hash length
|
|
212
|
-
* const badHash = new Uint8Array(10)
|
|
213
|
-
* sha1Verify(data, badHash) // false (wrong length)
|
|
214
|
-
* ```
|
|
215
|
-
*/
|
|
216
|
-
export function sha1Verify(data, expected) {
|
|
217
|
-
// Expected hash must be exactly 20 bytes
|
|
218
|
-
if (expected.length !== 20) {
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
const computed = sha1(data);
|
|
222
|
-
// Compare all 20 bytes
|
|
223
|
-
for (let i = 0; i < 20; i++) {
|
|
224
|
-
if (computed[i] !== expected[i]) {
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
// ============================================================================
|
|
231
|
-
// Pre-computed constants for streaming SHA-1
|
|
232
|
-
// ============================================================================
|
|
233
|
-
/**
|
|
234
|
-
* Initial hash values for SHA-1 (first 32 bits of fractional parts of square roots of first 5 primes)
|
|
235
|
-
* @internal
|
|
236
|
-
*/
|
|
237
|
-
const SHA1_H0 = 0x67452301;
|
|
238
|
-
const SHA1_H1 = 0xefcdab89;
|
|
239
|
-
const SHA1_H2 = 0x98badcfe;
|
|
240
|
-
const SHA1_H3 = 0x10325476;
|
|
241
|
-
const SHA1_H4 = 0xc3d2e1f0;
|
|
242
|
-
/**
|
|
243
|
-
* SHA-1 round constants
|
|
244
|
-
* @internal
|
|
245
|
-
*/
|
|
246
|
-
const SHA1_K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
247
|
-
/**
|
|
248
|
-
* Rotate left (circular left shift) operation.
|
|
249
|
-
* @internal
|
|
250
|
-
*/
|
|
251
|
-
function rotl(n, s) {
|
|
252
|
-
return ((n << s) | (n >>> (32 - s))) >>> 0;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Process a single 64-byte chunk in SHA-1
|
|
256
|
-
* @internal
|
|
257
|
-
*/
|
|
258
|
-
function processChunk(chunk, h, w) {
|
|
259
|
-
const chunkView = new DataView(chunk.buffer, chunk.byteOffset, 64);
|
|
260
|
-
// Break chunk into sixteen 32-bit big-endian words
|
|
261
|
-
for (let i = 0; i < 16; i++) {
|
|
262
|
-
w[i] = chunkView.getUint32(i * 4, false);
|
|
263
|
-
}
|
|
264
|
-
// Extend the sixteen 32-bit words into eighty 32-bit words
|
|
265
|
-
for (let i = 16; i < 80; i++) {
|
|
266
|
-
w[i] = rotl(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16], 1);
|
|
267
|
-
}
|
|
268
|
-
// Initialize working variables
|
|
269
|
-
let a = h[0];
|
|
270
|
-
let b = h[1];
|
|
271
|
-
let c = h[2];
|
|
272
|
-
let d = h[3];
|
|
273
|
-
let e = h[4];
|
|
274
|
-
// Main loop - 80 rounds
|
|
275
|
-
for (let i = 0; i < 80; i++) {
|
|
276
|
-
let f, k;
|
|
277
|
-
if (i < 20) {
|
|
278
|
-
f = (b & c) | (~b & d);
|
|
279
|
-
k = SHA1_K[0];
|
|
280
|
-
}
|
|
281
|
-
else if (i < 40) {
|
|
282
|
-
f = b ^ c ^ d;
|
|
283
|
-
k = SHA1_K[1];
|
|
284
|
-
}
|
|
285
|
-
else if (i < 60) {
|
|
286
|
-
f = (b & c) | (b & d) | (c & d);
|
|
287
|
-
k = SHA1_K[2];
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
f = b ^ c ^ d;
|
|
291
|
-
k = SHA1_K[3];
|
|
292
|
-
}
|
|
293
|
-
const temp = (rotl(a, 5) + f + e + k + w[i]) >>> 0;
|
|
294
|
-
e = d;
|
|
295
|
-
d = c;
|
|
296
|
-
c = rotl(b, 30);
|
|
297
|
-
b = a;
|
|
298
|
-
a = temp;
|
|
299
|
-
}
|
|
300
|
-
// Add this chunk's hash to result so far
|
|
301
|
-
h[0] = (h[0] + a) >>> 0;
|
|
302
|
-
h[1] = (h[1] + b) >>> 0;
|
|
303
|
-
h[2] = (h[2] + c) >>> 0;
|
|
304
|
-
h[3] = (h[3] + d) >>> 0;
|
|
305
|
-
h[4] = (h[4] + e) >>> 0;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Streaming SHA-1 hasher for processing large data incrementally.
|
|
309
|
-
*
|
|
310
|
-
* @description
|
|
311
|
-
* This class allows hashing data in chunks, which is essential for:
|
|
312
|
-
* - Processing large files without loading everything into memory
|
|
313
|
-
* - Computing hashes of data streams
|
|
314
|
-
* - Pack file generation and verification
|
|
315
|
-
*
|
|
316
|
-
* The hasher maintains internal state and can accept data through the
|
|
317
|
-
* `update()` method before finalizing with `digest()` or `digestHex()`.
|
|
318
|
-
*
|
|
319
|
-
* **Performance Note**: For small data (< 64 bytes), the non-streaming
|
|
320
|
-
* `sha1()` function may be slightly faster due to lower overhead.
|
|
321
|
-
*
|
|
322
|
-
* @class StreamingSHA1
|
|
323
|
-
*
|
|
324
|
-
* @example
|
|
325
|
-
* ```typescript
|
|
326
|
-
* // Hash a large file in chunks
|
|
327
|
-
* const hasher = new StreamingSHA1()
|
|
328
|
-
*
|
|
329
|
-
* for await (const chunk of fileStream) {
|
|
330
|
-
* hasher.update(chunk)
|
|
331
|
-
* }
|
|
332
|
-
*
|
|
333
|
-
* const hash = hasher.digestHex()
|
|
334
|
-
* console.log(`File hash: ${hash}`)
|
|
335
|
-
* ```
|
|
336
|
-
*
|
|
337
|
-
* @example
|
|
338
|
-
* ```typescript
|
|
339
|
-
* // Hash Git object with header
|
|
340
|
-
* const hasher = new StreamingSHA1()
|
|
341
|
-
* hasher.update(new TextEncoder().encode(`blob ${size}\0`))
|
|
342
|
-
* hasher.update(content)
|
|
343
|
-
* const objectId = hasher.digestHex()
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
export class StreamingSHA1 {
|
|
347
|
-
/** Hash state */
|
|
348
|
-
h;
|
|
349
|
-
/** Working array for chunk processing */
|
|
350
|
-
w;
|
|
351
|
-
/** Buffer for incomplete chunks */
|
|
352
|
-
buffer;
|
|
353
|
-
/** Current position in buffer */
|
|
354
|
-
bufferLength;
|
|
355
|
-
/** Total bytes processed */
|
|
356
|
-
totalLength;
|
|
357
|
-
/** Whether digest has been called */
|
|
358
|
-
finalized;
|
|
359
|
-
/**
|
|
360
|
-
* Creates a new StreamingSHA1 hasher instance.
|
|
361
|
-
*/
|
|
362
|
-
constructor() {
|
|
363
|
-
this.h = new Uint32Array([SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4]);
|
|
364
|
-
this.w = new Uint32Array(80);
|
|
365
|
-
this.buffer = new Uint8Array(64);
|
|
366
|
-
this.bufferLength = 0;
|
|
367
|
-
this.totalLength = 0n;
|
|
368
|
-
this.finalized = false;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Resets the hasher to its initial state.
|
|
372
|
-
*
|
|
373
|
-
* @description Allows reusing the same hasher instance for a new hash
|
|
374
|
-
* computation without creating a new object.
|
|
375
|
-
*
|
|
376
|
-
* @example
|
|
377
|
-
* ```typescript
|
|
378
|
-
* const hasher = new StreamingSHA1()
|
|
379
|
-
* hasher.update(data1)
|
|
380
|
-
* const hash1 = hasher.digestHex()
|
|
381
|
-
*
|
|
382
|
-
* hasher.reset()
|
|
383
|
-
* hasher.update(data2)
|
|
384
|
-
* const hash2 = hasher.digestHex()
|
|
385
|
-
* ```
|
|
386
|
-
*/
|
|
387
|
-
reset() {
|
|
388
|
-
this.h[0] = SHA1_H0;
|
|
389
|
-
this.h[1] = SHA1_H1;
|
|
390
|
-
this.h[2] = SHA1_H2;
|
|
391
|
-
this.h[3] = SHA1_H3;
|
|
392
|
-
this.h[4] = SHA1_H4;
|
|
393
|
-
this.bufferLength = 0;
|
|
394
|
-
this.totalLength = 0n;
|
|
395
|
-
this.finalized = false;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Updates the hash with additional data.
|
|
399
|
-
*
|
|
400
|
-
* @description Processes the input data, updating the internal hash state.
|
|
401
|
-
* Data is buffered internally until a complete 64-byte chunk is available,
|
|
402
|
-
* then processed immediately.
|
|
403
|
-
*
|
|
404
|
-
* This method can be called multiple times before finalizing with `digest()`.
|
|
405
|
-
*
|
|
406
|
-
* @param {Uint8Array} data - Data to add to the hash computation
|
|
407
|
-
* @returns {this} The hasher instance for method chaining
|
|
408
|
-
* @throws {Error} If called after digest() without reset()
|
|
409
|
-
*
|
|
410
|
-
* @example
|
|
411
|
-
* ```typescript
|
|
412
|
-
* const hasher = new StreamingSHA1()
|
|
413
|
-
* .update(header)
|
|
414
|
-
* .update(content)
|
|
415
|
-
* .update(footer)
|
|
416
|
-
* const hash = hasher.digestHex()
|
|
417
|
-
* ```
|
|
418
|
-
*/
|
|
419
|
-
update(data) {
|
|
420
|
-
if (this.finalized) {
|
|
421
|
-
throw new Error('Cannot update after digest() - call reset() first');
|
|
422
|
-
}
|
|
423
|
-
this.totalLength += BigInt(data.length);
|
|
424
|
-
let offset = 0;
|
|
425
|
-
// If we have buffered data, try to complete a chunk
|
|
426
|
-
if (this.bufferLength > 0) {
|
|
427
|
-
const needed = 64 - this.bufferLength;
|
|
428
|
-
const available = Math.min(needed, data.length);
|
|
429
|
-
this.buffer.set(data.subarray(0, available), this.bufferLength);
|
|
430
|
-
this.bufferLength += available;
|
|
431
|
-
offset = available;
|
|
432
|
-
if (this.bufferLength === 64) {
|
|
433
|
-
processChunk(this.buffer, this.h, this.w);
|
|
434
|
-
this.bufferLength = 0;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
// Process complete 64-byte chunks directly from input
|
|
438
|
-
while (offset + 64 <= data.length) {
|
|
439
|
-
processChunk(data.subarray(offset, offset + 64), this.h, this.w);
|
|
440
|
-
offset += 64;
|
|
441
|
-
}
|
|
442
|
-
// Buffer remaining bytes
|
|
443
|
-
if (offset < data.length) {
|
|
444
|
-
this.buffer.set(data.subarray(offset), this.bufferLength);
|
|
445
|
-
this.bufferLength += data.length - offset;
|
|
446
|
-
}
|
|
447
|
-
return this;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Finalizes the hash computation and returns the 20-byte digest.
|
|
451
|
-
*
|
|
452
|
-
* @description Applies SHA-1 padding to the remaining data and computes
|
|
453
|
-
* the final hash. After calling this method, the hasher cannot be updated
|
|
454
|
-
* unless `reset()` is called.
|
|
455
|
-
*
|
|
456
|
-
* @returns {Uint8Array} 20-byte SHA-1 hash
|
|
457
|
-
*
|
|
458
|
-
* @example
|
|
459
|
-
* ```typescript
|
|
460
|
-
* const hasher = new StreamingSHA1()
|
|
461
|
-
* hasher.update(data)
|
|
462
|
-
* const hashBytes = hasher.digest()
|
|
463
|
-
* console.log(hashBytes.length) // 20
|
|
464
|
-
* ```
|
|
465
|
-
*/
|
|
466
|
-
digest() {
|
|
467
|
-
if (this.finalized) {
|
|
468
|
-
// Return cached result
|
|
469
|
-
const result = new Uint8Array(20);
|
|
470
|
-
const resultView = new DataView(result.buffer);
|
|
471
|
-
resultView.setUint32(0, this.h[0], false);
|
|
472
|
-
resultView.setUint32(4, this.h[1], false);
|
|
473
|
-
resultView.setUint32(8, this.h[2], false);
|
|
474
|
-
resultView.setUint32(12, this.h[3], false);
|
|
475
|
-
resultView.setUint32(16, this.h[4], false);
|
|
476
|
-
return result;
|
|
477
|
-
}
|
|
478
|
-
this.finalized = true;
|
|
479
|
-
const bitLen = this.totalLength * 8n;
|
|
480
|
-
// Pad message: append 1 bit (0x80)
|
|
481
|
-
this.buffer[this.bufferLength] = 0x80;
|
|
482
|
-
this.bufferLength++;
|
|
483
|
-
// If we don't have room for the 64-bit length, fill and process this chunk
|
|
484
|
-
if (this.bufferLength > 56) {
|
|
485
|
-
// Fill rest with zeros and process
|
|
486
|
-
this.buffer.fill(0, this.bufferLength, 64);
|
|
487
|
-
processChunk(this.buffer, this.h, this.w);
|
|
488
|
-
this.bufferLength = 0;
|
|
489
|
-
}
|
|
490
|
-
// Fill with zeros up to length field
|
|
491
|
-
this.buffer.fill(0, this.bufferLength, 56);
|
|
492
|
-
// Write length as 64-bit big-endian
|
|
493
|
-
const lengthView = new DataView(this.buffer.buffer, this.buffer.byteOffset, 64);
|
|
494
|
-
lengthView.setBigUint64(56, bitLen, false);
|
|
495
|
-
// Process final chunk
|
|
496
|
-
processChunk(this.buffer, this.h, this.w);
|
|
497
|
-
// Produce the final hash value (big-endian)
|
|
498
|
-
const result = new Uint8Array(20);
|
|
499
|
-
const resultView = new DataView(result.buffer);
|
|
500
|
-
resultView.setUint32(0, this.h[0], false);
|
|
501
|
-
resultView.setUint32(4, this.h[1], false);
|
|
502
|
-
resultView.setUint32(8, this.h[2], false);
|
|
503
|
-
resultView.setUint32(12, this.h[3], false);
|
|
504
|
-
resultView.setUint32(16, this.h[4], false);
|
|
505
|
-
return result;
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Finalizes the hash computation and returns the hex string digest.
|
|
509
|
-
*
|
|
510
|
-
* @description Convenience method that calls `digest()` and converts
|
|
511
|
-
* the result to a 40-character lowercase hexadecimal string.
|
|
512
|
-
*
|
|
513
|
-
* @returns {string} 40-character lowercase hexadecimal hash string
|
|
514
|
-
*
|
|
515
|
-
* @example
|
|
516
|
-
* ```typescript
|
|
517
|
-
* const hasher = new StreamingSHA1()
|
|
518
|
-
* hasher.update(data)
|
|
519
|
-
* const hash = hasher.digestHex()
|
|
520
|
-
* console.log(hash) // 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
|
|
521
|
-
* ```
|
|
522
|
-
*/
|
|
523
|
-
digestHex() {
|
|
524
|
-
const hash = this.digest();
|
|
525
|
-
let hex = '';
|
|
526
|
-
for (let i = 0; i < hash.length; i++) {
|
|
527
|
-
hex += hash[i].toString(16).padStart(2, '0');
|
|
528
|
-
}
|
|
529
|
-
return hex;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Hash a Git object with streaming support for large objects.
|
|
534
|
-
*
|
|
535
|
-
* @description
|
|
536
|
-
* Uses the streaming hasher to compute the SHA-1 of a Git object with its header.
|
|
537
|
-
* This is more memory-efficient than `hashObject` in `hash.ts` for large objects
|
|
538
|
-
* as it doesn't require concatenating header and data.
|
|
539
|
-
*
|
|
540
|
-
* @param type - Object type ('blob', 'tree', 'commit', 'tag')
|
|
541
|
-
* @param data - Object content as binary data
|
|
542
|
-
* @returns 20-byte SHA-1 hash as Uint8Array
|
|
543
|
-
*
|
|
544
|
-
* @example
|
|
545
|
-
* ```typescript
|
|
546
|
-
* const content = new TextEncoder().encode('hello')
|
|
547
|
-
* const hashBytes = hashObjectStreaming('blob', content)
|
|
548
|
-
* ```
|
|
549
|
-
*/
|
|
550
|
-
export function hashObjectStreaming(type, data) {
|
|
551
|
-
const hasher = new StreamingSHA1();
|
|
552
|
-
const header = new TextEncoder().encode(`${type} ${data.length}\0`);
|
|
553
|
-
hasher.update(header);
|
|
554
|
-
hasher.update(data);
|
|
555
|
-
return hasher.digest();
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Hash a Git object with streaming support, returning hex string.
|
|
559
|
-
*
|
|
560
|
-
* @description
|
|
561
|
-
* Convenience wrapper that returns the hash as a 40-character hex string
|
|
562
|
-
* instead of raw bytes.
|
|
563
|
-
*
|
|
564
|
-
* @param type - Object type ('blob', 'tree', 'commit', 'tag')
|
|
565
|
-
* @param data - Object content as binary data
|
|
566
|
-
* @returns 40-character lowercase hexadecimal SHA-1 hash
|
|
567
|
-
*
|
|
568
|
-
* @example
|
|
569
|
-
* ```typescript
|
|
570
|
-
* const content = new TextEncoder().encode('hello')
|
|
571
|
-
* const sha = hashObjectStreamingHex('blob', content)
|
|
572
|
-
* console.log(sha) // 'b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0'
|
|
573
|
-
* ```
|
|
574
|
-
*/
|
|
575
|
-
export function hashObjectStreamingHex(type, data) {
|
|
576
|
-
const hasher = new StreamingSHA1();
|
|
577
|
-
const header = new TextEncoder().encode(`${type} ${data.length}\0`);
|
|
578
|
-
hasher.update(header);
|
|
579
|
-
hasher.update(data);
|
|
580
|
-
return hasher.digestHex();
|
|
581
|
-
}
|
|
582
|
-
//# sourceMappingURL=sha1.js.map
|
package/dist/utils/sha1.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sha1.js","sourceRoot":"","sources":["../../src/utils/sha1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,IAAI,CAAC,IAAgB;IACnC;;;OAGG;IACH,SAAS,IAAI,CAAC,CAAS,EAAE,CAAS;QAChC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAC5C,CAAC;IAED,+FAA+F;IAC/F,IAAI,EAAE,GAAG,UAAU,CAAA;IACnB,IAAI,EAAE,GAAG,UAAU,CAAA;IACnB,IAAI,EAAE,GAAG,UAAU,CAAA;IACnB,IAAI,EAAE,GAAG,UAAU,CAAA;IACnB,IAAI,EAAE,GAAG,UAAU,CAAA;IAEnB,8BAA8B;IAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;IAElC,4DAA4D;IAC5D,wDAAwD;IACxD,MAAM,aAAa,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAA;IACrD,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,GAAG,aAAa,GAAG,CA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