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

353
Visualizações
How to get a specific hash value from a specific string?

I am looking at some docs for Lightning invoices creation at https://github.com/lightning/bolts/blob/master/11-payment-encoding.md#now-send-24-for-an-entire-list-of-things-hashed.

They say a SHA256 hash of

One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon

is

8yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqs

When I create an invoice with a LND, it returns an invoice which is when decoded, shows the same value, but when I try to hash the source string with JavaScript or with online tools, I never get a string like that.

Here is what I get with JavaScript:

createHash('sha256').update(str).digest('hex')

3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1

Online tools gives no the result I expect as well.

So, I suppose there is some extra encode/decode procedure happening under the hood.

How do I turn One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon into 8yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqs?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I used the bech32-converting lib to check this:

conv = require('bech32-converting')
conv("").toBech32("3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1")

> '18yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspe7lh6'

which contains the result... Note there is a 1 is prepended and pe7lh6 :

The first char (1) is the Bech32 separator which is always 1 (using conv("bc") above would prepend bc for example)

The last six characters (pe7lh6) are the Bech32 checksum

about 4 years ago · Juan Pablo Isaza Relatório
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