sha256
Calculate SHA-256 cryptographic hash for any input string to verify data integrity and generate secure digital fingerprints.
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)Handler function that takes input string, computes SHA-256 hash using DigestUtil.sha256, and returns it as text content.({ input }) => { const hash = DigestUtil.sha256(input); return { content: [{ type: "text", text: hash }], }; }
- src/service/digest.ts:104-106 (schema)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)Helper utility function DigestUtil.sha256 that computes the SHA-256 hash of the input string using CryptoJS.static sha256(input: string): string { const hash = CryptoJS.SHA256(input); return hash.toString(); }