Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
Reverse hash function to get same output

I have this compress/hash function (compresses a string into a short number)

function compress(input) {
        let output = 0;
        for (let i=0; i < input.length; i++) {
            output = (output << 5) - output + input.charCodeAt(i)
            output &= output;
        }
        return output;
    }

Now I'm searching for an algorithm where i can input a number and then get a string back (I'm not searching for the original string). This String should produce the same hash wen compressing it again.

Example

let compress1 = compress("Hello") // => 69609650
let deob = expand(compress1) // => ??
let compress2 = compress(deob) // => 69609650
compress1 === compress2 // should be true

One idea i had, i cloud just try out random strings and then save the output with the input in a key-value map, but this would take some time. Is there an more efficient way to find a string that produces the same hash (for a given hash)?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda