Support for Arbitrary Hashes and Checksums #130
scholarsmate
started this conversation in
Ideas
Replies: 1 comment
-
Some thoughts: I like the usage of being able to connect external hashing utilities. My go-to thought for implementing hashing would be to use a library like https://www.npmjs.com/package/jshashes?activeTab=readme, and it seems like it supports common hashing algorithms. I'm guessing that it's better to use external hashing utilities due to the fact there may be certain algorithms that aren't supported by the library? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be advantageous for the Daffodil Data Editor extension for Visual Studio Code to support selecting an arbitrary byte range from a source file and sending it to an external utility for computing hashes (e.g., MD5, SHA-2) or checksums (e.g. SUM, CRC-16, CRC-32). The computed result should be displayed within the UI and optionally inserted at a specified offset within the source file.
To enable this, a standardized interface can be defined whereby the selected byte range is streamed to the external tool via standard input, and the computed result is read from standard output (e.g., using md5sum, sha512sum). If a tool does not conform to this I/O convention, users may implement a wrapper script to adapt its behavior accordingly.
Workflow
User selects a segment of data from the source file in VSCode.
User selects the external tool to send the segment to, then clicks "Go" to dispatch the task.
Child process is spawned in Node.js to run the external utility, the selected segment is piped into it, and the results are collected from stdout and stderr.
4a. stdout is then parsed by the extension in VSCode and displayed to the user.
4b. stderr is routed to the logs.
Implementation Ideas
Allow users to register external tools in the extension’s settings, specifying:
Validate tool path, permissions, and modes.
Execute external tools in a subprocess with:
Provide fallback behavior and clear error reporting if:
Include unit tests for:
This design ensures flexibility while maintaining a consistent user experience and aligning with standard UNIX-like tool conventions.
Example JSON Schema
Example JSON Configuration
JSON like the following could be integrated in a contributes.configuration block in package.json:
Beta Was this translation helpful? Give feedback.
All reactions