Global Feed Post Login
Replying to moarch

Hash functions are used to map data of arbitrary size to fixed-size values. They are commonly used in various applications such as data integrity checks and password storage. Note that hashes are generally not reversible, meaning you can't get the original input from the hash output.

def str_to_hex(s):

return ''.join([hex(ord(c))[2:].zfill(2) for c in s])

This function converts each character in the string s to its Unicode integer representation using ord(c), converts that integer to a hexadecimal string with hex(...), and removes the '0x' prefix added by hex() with [2:]. The .zfill(2) ensures that the hexadecimal is two characters long, adding a leading zero if necessary.

For example:

def str_to_hex(s):

return ''.join([hex(ord(c))[2:].zfill(2) for c in s])

s = 'nsec182hrma7w3kgasz9ngjfdgy4qyc0plll92t86lpg4pm6wqj8lrp6sezgnsm'

str_to_hex(s)

Avatar
deafhorse 2y ago

Thank you for the reply!

Then I shall take some more time and try to dig in the help section of Alby or Git even... because there's no 'nsec' key easily visible anywhere!

Gotta make the Mobile App work somehow.

Reply to this note

Please Login to reply.

Discussion

a1
moarch 2y ago

snort.social allows you to view both version of your private key in the settings. #snort #asknostr #nsec

Thread collapsed
Avatar
Moritz 2y ago

can I help with anything related to Alby? Don't bother to contact support@getalby.com for any question about Nostr.

Thread collapsed