Skip to main content
Glama

sha1

Calculate SHA-1 cryptographic hash values for text strings to verify data integrity and generate unique identifiers.

Instructions

Calculate SHA-1 hash of a string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe input string to hash

Implementation Reference

  • The inline handler function that executes the sha1 tool logic by calling DigestUtil.sha1 and returning the hash as text content.
    ({ input }) => {
      const hash = DigestUtil.sha1(input);
      return {
        content: [{ type: "text", text: hash }],
      };
    }
  • The input schema for the sha1 tool, validating input as a string using Zod.
    {
      input: z.string().describe("The input string to hash"),
    },
  • Registration of the sha1 tool on the MCP server, including name, description, schema, and handler.
    server.tool(
      "sha1",
      "Calculate SHA-1 hash of a string",
      {
        input: z.string().describe("The input string to hash"),
      },
      ({ input }) => {
        const hash = DigestUtil.sha1(input);
        return {
          content: [{ type: "text", text: hash }],
        };
      }
  • Helper utility function in DigestUtil class that computes the SHA-1 hash of the input string using CryptoJS.
    static sha1(input: string): string {
      const hash = CryptoJS.SHA1(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