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

360
Views
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 answers
Answer question

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 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!