Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
Doble hash de dos TX

Estoy buscando duplicar hash dos tx, para construir el árbol merkle

Este

 const bsv = require("bsv"); var tx1 = '3a459eab5f0cf8394a21e04d2ed3b2beeaa59795912e20b9c680e9db74dfb18c'; var tx2 = 'be38f46f0eccba72416aed715851fd07b881ffb7928b7622847314588e06a6b7'; bsv.crypto.Hash.sha256sha256(Buffer.concat( [ tx1, tx2 ].map( v => Buffer.from(v, 'hex') ) )).toString('hex');

me esta dando

 215f8397a3090a0bc8f4a2e98609a10d55fc7b939fa1ecf9803df20b1ee089a2

pero debería ser

 13a3595f2610c8e4d727130daade66c772fdec4bd2463d773fd0f85c20ced32d

¿Cómo obtengo el resultado correcto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Como se señaló, primero debe convertir hashes tx en little endian antes de continuar con concat() y un doble hash.

Dado que está utilizando Buffer , esto se puede hacer de manera efectiva con .reverse() ,

 const bsv = require("bsv"); var tx1 = '3a459eab5f0cf8394a21e04d2ed3b2beeaa59795912e20b9c680e9db74dfb18c'; var tx2 = 'be38f46f0eccba72416aed715851fd07b881ffb7928b7622847314588e06a6b7'; bsv.crypto.Hash.sha256sha256(Buffer.concat( [ tx1, tx2 ].map( v => Buffer.from(v, 'hex').reverse() ) )).reverse().toString('hex');
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!