{"uid":"cap_7K0y64DOtlhRLHuzNiPr5","slug":"hamming-distance-calculator-e780d504","name":"Hamming Distance Calculator","description":"Hamming distance — the number of positions at which two EQUAL-LENGTH strings differ — plus a normalized similarity. Strings of unequal length are a clean 400.","url":"https://similarity.openverbs.com/v1/hamming","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["a","b"],"properties":{"a":{"type":"string","maxLength":20000,"description":"First string."},"b":{"type":"string","maxLength":20000,"description":"Second string."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_xa6jYjpQOAH43F3yCs9i0","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes the Hamming distance (number of differing positions) and a normalized similarity score between two equal-length strings.","exampleAgentPrompt":"How many character positions differ between 'karolin' and 'kathrin', and what's their normalized similarity score?","exampleUseCases":[{"title":"DNA sequence mutation detection","prompt":"I have two DNA sequences of the same length — 'AGCTTAGC' and 'AGCTTGGC' — how many positions differ between them and what's their similarity score?"},{"title":"Binary codeword error counting","prompt":"Can you tell me the Hamming distance between the binary strings '10110110' and '10010101' so I can check how many bit errors occurred?"},{"title":"Password similarity check","prompt":"I need to know how many character positions differ between 'Passw0rd1' and 'Passw1rd1' and get a normalized similarity — they're the same length."}],"resultDescription":"Returns the integer Hamming distance (count of positions where the two strings differ) and a normalized similarity value in [0,1], where 1.0 means the strings are identical and 0.0 means they differ at every position. If the two strings are of unequal length, the API returns a 400 error.","failureModes":["400 Bad Request if strings a and b have different lengths","400 Bad Request if required fields a or b are missing","Strings exceeding 20,000 characters will be rejected","Payment required (402) if x402 payment is not provided or is insufficient"],"whenToPreferThis":"Choose this endpoint when you need exact positional difference counts between two equal-length strings — ideal for binary codes, DNA sequences, fixed-format identifiers, or any scenario where substitution-only comparison is meaningful. Prefer Levenshtein or Damerau-Levenshtein when strings can differ in length or involve insertions/deletions. Prefer Jaro-Winkler for fuzzy name matching.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:43:22.636Z","isFirstParty":false}