sha256
Generate SHA-256 hash values for input strings to ensure data integrity and secure processing within the Crypto_MCP server's encryption framework.
Instructions
Calculate SHA-256 hash of a string
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | The input string to hash |
Implementation Reference
- src/service/digest.ts:107-112 (handler)Inline handler function for the sha256 tool that calls the DigestUtil.sha256 helper and returns the hash as text content in MCP format.({ input }) => { const hash = DigestUtil.sha256(input); return { content: [{ type: "text", text: hash }], }; }
- src/service/digest.ts:104-106 (schema)Zod input schema defining a single string parameter for the input to hash.{ input: z.string().describe("The input string to hash"), },
- src/service/digest.ts:101-113 (registration)Registration of the sha256 tool on the McpServer, including name, description, schema, and handler.server.tool( "sha256", "Calculate SHA-256 hash of a string", { input: z.string().describe("The input string to hash"), }, ({ input }) => { const hash = DigestUtil.sha256(input); return { content: [{ type: "text", text: hash }], }; } );
- src/service/digest.ts:31-34 (helper)DigestUtil static method implementing the SHA-256 hash computation using CryptoJS.SHA256.static sha256(input: string): string { const hash = CryptoJS.SHA256(input); return hash.toString(); }