paragonie/ciphersweet

Third padding constant C3

Closed this issue · 1 comments

For a third information in the database which I want to hash, I want to use a third padding constant C3 for domain seperation concerns. I've read your article regarding hamming distance:

C1 is the byte 0xB4 repeated 32 times.
C2 is the byte 0x7E repeated 32 times.

The constants C1 and C2 were chosen to have a Hamming distance of 32*4 = 128b between them, and are used to achieve domain separation for secure key splitting.

https://ciphersweet.paragonie.com/internals/key-hierarchy

I think 0xE8 would be suitable since it has a hamming distance of 4 to each 0xB4 and 0x7E. However, I am not sure if it is part of any HMAC padding constant as you also have written in your article.

Do you think 0xE8 is fine or would you suggest another constant?

Sure. You could even get away with using 0x01 and 0x02 for domain separation in most protocols. We took inspiration from HMAC's design, but it isn't strictly necessary to do so.