I've been working on a website which will be caring out various cryptographic operations. On the website users can post Ads. Each Ad has a monotonically increasing unique ID. For each Ad, I would like to generate a unique private key to be used for signing. So far, as a temporary measure, I've been calculating this (secp256k1) key by hashing an unchanging server seed concatenated with the unique ID for each Ad. The resulting hash can be used as a private key. I had a feeling this was bad practice and I found this article which explains the values of HMAC(data, salt) vs just SHA256(data . salt) https://security.stackexchange.com/questions/79577/whats-the-difference-between-hmac-sha256key-data-and-sha256key-data/79579. After looking at the answers it's clear to me I was at fault for simply concatenating the ID with the server seed. My question is, what are the merits of using an HD Wallet vs an HMAC algorithm to derive the key. With an HD wallet I would import one server seed and set the derivation path according to the ID of the Ad.

In summary currently my algorithm is this: Sha256(server_key . listing_id) but I'd like to know the merits of using an HD Wallet vs Just using an HMAC based algorithm such as HMAC(server_key, listing_id). My gut tells me that the HD wallet with a derivation path pertaining to the listing ID is the right answer but I'd like to know exactly what the merits are. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.