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

150
Vistas
Conduct sha256 operation in BITS mode

I am trying to conduct a hashing operation in BITS mode using Javascript.

The examples below I am trying to hash the following binary string: 0010010011100100

In BITS mode, ASCII '0' is interpreted as 0-bit, ASCII '1' interpreted as 1-bit, and all other characters are ignored. Read more here.

I can obtain the expected output in the command line with echo 0010010011100100 | shasum -a 256 -0, which outputs the expected result (86e89f2cdc1c84f2722cb39341c1888113d61a66f46df75803cfce9d5c9a8637)

However, I am unable to figure out how to get the same output in JS (preferably plain JS with no libraries). I keep getting a "non-BITS mode" result.

Here is what I have so far. This outputs a normal hash (without BITS mode).

const crypto = require('crypto');
function sha256(string) {
  return crypto.createHash('sha256').update(string).digest('hex');
}

Any ideas would be great! Thanks!

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