Skip to main content
Glama

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
NameRequiredDescriptionDefault
inputYesThe input string to hash

Implementation Reference

  • 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 }],
      };
    }
  • Input schema defining a single string parameter for the input to hash.
    {
      input: z.string().describe("The input string to hash"),
    },
  • 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 }],
        };
      }
    );
  • 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();
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/1595901624/crypto-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server