How to Verify SHA256 Hashing Is Correct for EMQ

Verify SHA256 Hashing

The cryptographic test lab. Verify your customer data normalization and SHA256 hashing against official reference vectors.

Deploy CAPI Control Free
Quick Answer • Key Principle

To verify that your SHA256 hashing is correct for Meta CAPI, run known test inputs through your backend hashing function and compare the output against official reference vectors. For example, the normalized email '[email protected]' must ALWAYS produce the exact 64-character hash: '973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b'. If your output differs, your normalization or encoding is flawed.

1. The Silent Plague of Incorrect Hashes

Because SHA256 hashes are unreadable 64-character strings of random-looking letters and numbers, developers cannot visually spot errors. A function might output a valid-looking hash that is completely useless to Meta's matching algorithm.

Common culprits include: hashing the string before trimming spaces, running SHA256 on an empty string (`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`), or using UTF-16 encoding instead of UTF-8. Testing against known reference vectors is the only foolproof verification method.

Core Failure Modes Identified
  • Empty String Hashes: Passing hashes of empty form inputs.
  • Encoding Mismatches: Hashing UTF-16 strings instead of standard UTF-8.
  • Case Sensitivity Defects: Generating different hashes for capitalized emails.

2. Comparative Analysis: Standard Tracking vs CAPI Control

The table below outlines the architectural and financial differences between passive conversion tracking and active signal governance:

Test Input StringExpected Normalized InputExact Expected SHA256 Hash
[email protected] [email protected]973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b
(415) 555-2671 (US)14155552671b304c10a4cf02cb85923ee6f1c4dfeb8c6c9a38541a4a169b1424df72f778d9b
John (First Name)johna8cfcd74832004951b4408cdb0a5dbcd8c7e52d43f7fe244bf720582e05241da

3. Automated Unit Test for CAPI Hashing

Add this automated unit test to your CI/CD pipeline to verify hashing integrity before deploying tracking code:

// Jest / Vitest Unit Test for CAPI Hashing
import { hashEmail, hashPhone } from "./capi-utils";

describe("Meta CAPI Hashing Integrity", () => {
  it("should correctly normalize and hash emails", () => {
    const rawInput = "  [email protected]  ";
    const expected = "973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b";
    expect(hashEmail(rawInput)).toBe(expected);
  });

  it("should correctly normalize and hash US phone numbers", () => {
    const rawPhone = "(415) 555-2671";
    const expected = "b304c10a4cf02cb85923ee6f1c4dfeb8c6c9a38541a4a169b1424df72f778d9b";
    expect(hashPhone(rawPhone, "1")).toBe(expected);
  });
});
Implementation Roadmap

How to Deploy CAPI Control to Fix This Today

  1. Step 1: Run your backend hashing function against the reference vectors above.
  2. Step 2: Ensure the output matches character-for-character.
  3. Step 3: Deploy CAPI Control to automate normalization and ensure 100% hashing compliance.
  4. Step 4: Maintain peak Event Match Quality on all customer identification fields.
Deploy CAPI Control Free in 2 Minutes →

Frequently Asked Questions

What is the hash of an empty string in SHA256?

An empty string produces `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`. If you see this hash in your logs, your code is hashing empty fields!

Does Meta accept MD5 or SHA1?

No. Meta Conversions API strictly mandates SHA256. MD5 and SHA1 hashes are permanently rejected.

Do I need to hash client_ip_address or client_user_agent?

NO! IP address and User-Agent must be passed as raw, unhashed plaintext strings.

Zero-Risk Deployment

Ready to steer Meta & Google toward your most profitable traffic?

Drop in CAPI Control in under 2 minutes. Transmit 100% of conversion signals free forever, or activate autonomous signal AI agents to get 3x better ad traffic.

Deploy Free CAPI Control →