Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda