{"uid":"cap_V3Zfp6pmzqJgoYfIkZIIN","slug":"crypto-math-encoding-converter-4be81785","name":"Crypto Math Encoding Converter","description":"Convert public bytes between hex, base64 and base64url (RFC 4648) with strict decoding and expected-length check.","url":"https://crypto-math.x402tookit.com/encoding?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["input","from"],"properties":{"from":{"type":"string","description":"Input format: hex, base64, base64url or utf8"},"input":{"type":"string","description":"The value to convert (a hash, public key, nonce or text; never a secret)"},"expectBytes":{"type":"integer","description":"Expected byte length to verify, e.g. 32 for a SHA-256 digest"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"hex":{"type":["null","string"]},"asOf":{"type":["null","string"]},"bytes":{"type":["array","null"],"items":{"type":"number"}},"base64":{"type":["null","string"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"base64url":{"type":["null","string"]},"bitLength":{"type":["null","number"]},"canonical":{"type":["boolean","null"]},"byteLength":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"lengthMatches":{"type":["boolean","null"]},"bytesTruncated":{"type":["boolean","null"]},"lengthExpected":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_21XD03kulZKn_zUOx6emC","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Convert public byte strings between hex, base64, and base64url (RFC 4648) with strict decoding and optional expected-length verification.","exampleAgentPrompt":"Convert this SHA-256 hex digest to base64url and confirm it's exactly 32 bytes: a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e","exampleUseCases":[{"title":"Normalize public key for JWK","prompt":"I have an EC public key in hex — 04a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e — can you convert it from hex to base64url so I can use it in a JSON Web Key?"},{"title":"Verify SHA-256 digest length","prompt":"Take this base64-encoded digest SGVsbG8gV29ybGQ= and decode it from base64, then confirm it's exactly 32 bytes long."},{"title":"Convert nonce for API header","prompt":"I need to send this nonce in a request header as hex, but I only have it in base64url format: SGVsbG8t. Can you convert it from base64url to hex?"}],"resultDescription":"Returns an object containing the input value re-encoded as hex, base64, and base64url simultaneously, along with the raw byte array, byte length, bit length, a canonical flag indicating whether the input was in canonical form, and a lengthMatches boolean if an expected byte length was provided. Also includes a summary and any validation reasons or warnings.","failureModes":["Non-canonical base64/base64url padding causes strict-decode rejection","Input length does not match expectBytes, returning lengthMatches: false","Unknown or missing 'from' format parameter causes a validation error","Malformed hex string (odd length, non-hex characters) fails decoding","Empty input string returns an error or empty result"],"whenToPreferThis":"Choose this endpoint when you need strict RFC 4648 compliant encoding conversion between hex, base64, and base64url for public cryptographic values (hashes, public keys, nonces), especially when you also need to verify the decoded byte length matches an expected value like 32 bytes for SHA-256 or 65 bytes for an uncompressed EC point. Prefer it over general-purpose base64 libraries when canonical-form checking and multi-format output in a single call are required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:12:44.268Z","isFirstParty":false,"canonicalSlug":"crypto-math-encoding-converter-4be81785"}