Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLIP-0039 Clarification on the string concatenation operator #497

Closed
Sharpiro opened this issue Jan 5, 2019 · 2 comments
Closed

SLIP-0039 Clarification on the string concatenation operator #497

Sharpiro opened this issue Jan 5, 2019 · 2 comments

Comments

@Sharpiro
Copy link

Sharpiro commented Jan 5, 2019

I wanted to clarify the usage of the string concatenation operator || when used with the master secret derivation functions.

Based on the short explanation found in the notation table, it makes sense to use that operator whenever we are doing the big-endian binary string concatenations.

However, for the PBKDF2 derivation functions, I noticed that this operator is also being used, despite the following paragraph that implies that string concatenation is not used, but instead a specific encoding must be followed in order to create the salt for the function.

Each of the master secret derivation functions uses the key derivation function PBKDF2. Whenever the random identifier value id or the threshold T is an input to PBKDF2, it is encoded in the following manner. The random identifier value is split into three 10-bit integers each encoded as two bytes in little-endian byte order. The threshold is encoded as one byte.

Example confusing usage:

key = PBKDF2(PRF = HMAC-SHA256, Password = passphrase, Salt = ("slip0039" || id || T), iterations = 20000, dkLen = 256 bits)
@onvej-sl
Copy link
Contributor

onvej-sl commented Feb 1, 2019

The meaning of the expression "slip0039" || id || T is the following. The random identifier value is encoded into two bytes and the threshold is encoded into one byte, according to the quoted paragraph. The resulting value is the concatenation of the byte string b"slip0039" and these three bytes.

Assume id = 725425835, T = 3, then
"slip0039" || id || T = 0x736c697030303339b3024703ab0203.

@Sharpiro
Copy link
Author

Sharpiro commented Feb 2, 2019

Thank you for that example, that was helpful. I guess I just find it confusing that under Notation, || is called the, "string concatenation operator", when in this case it is doing byte or bytes concatenation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants