Subject: [Hipsec] Help needed - text to octet for HIP-DEX

From: Robert Moskowitz <[email-masked]>
Date: Wed, 18 Mar 2020 22:47:48 -0400

There are two strings used in the KEYMAT process i HIP-DEX:

CKDF-Extract
and
CKDF-Expand

The draft says that they are "an octet string".

Thing is that depending on which google found tool, I get different text 
to octet values!

So to those implementors out there:

What is the proper octet strings for the above two text strings?

thanks.

---

From: Jeff Ahrenholz <[email-masked]>
Date: Thu, 19 Mar 2020 21:55:30 +0000

Bob et al.,

>    What is the proper octet strings for the above two text strings?

From an implementation perspective, here are some Python3 snippets:
(ord() returns the Unicode codepoint for a character, 
 oct() returns the octal representation, and
 hex() returns the hexadecimal representation)

input="CKDF-Extract"

# the values Roman suggested, shown as ASCII decimal values:
>>> list(map(lambda i: ord(i), input))
[67, 75, 68, 70, 45, 69, 120, 116, 114, 97, 99, 116]

# the tool you were using showed octal values:
>>> list(map(lambda i: oct(ord(i)), input))
['0o103', '0o113', '0o104', '0o106', '0o55', '0o105', '0o170', '0o164', '0o162', '0o141', '0o143', '0o164']

# hex representation of the above:
>>> list(map(lambda i: hex(ord(i)), input))
['0x43', '0x4b', '0x44', '0x46', '0x2d', '0x45', '0x78', '0x74', '0x72', '0x61', '0x63', '0x74']

In the appendix of e.g. RFC 5201, we show hexadecimal values... in this case you could put:
input text: "CKDF-Extract"
hex string: 0x434b44462d45787472616374

input text: "CKDF-Expand"
hex string: 0x434b44462d457870616e64

So the hex looks good to me, but you could use either of the other representations as long as we explicitly state what they are.

-Jeff