Distancia de Hamming
hamming-distanceCuenta posiciones distintas entre dos cadenas de igual longitud (o bits en hex). Cuándo: hay que transformar, comparar o medir un texto con exactitud y no por aproximación. No para: calcular la distancia de edición de Levenshtein entre dos cadenas y similitud normalizada (levenshtein-distance). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Counts positions where two equal-length strings (by code point) or hex byte strings (bit level) differ. When: text has to be transformed, compared or measured exactly instead of approximated. Not for: computing the edit distance (levenshtein-distance). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | First (string; required). | |
| b | Yes | Second (string; required). | |
| mode | No | Compare characters or bits of hex input (optional; one of: chars, hex_bits; default "chars"). | chars |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| distance | No |