Hide

Problem B
M1: CCM

This is the $2$nd of $4$ steps in the Rover problem. The complete problem specification is on the NSA Cyber Challenge website.

Encoding

Every input and output line contains binary data encoded as a string using the “hexlify” method (named for the way Python implements it in the binascii module). The binary $32$-bit unsigned integer represented in hexadecimal as 0xDEADBEEF would simply be converted into an ASCII string “deadbeef” (always use lower-case letters). The most significant bytes come first.

Input

The first lines of the input will be the parameters to use for the rest of the input. The first line will contain the device ID (a single byte). The second line will contain the key. The keys are $32$ bytes so they will be represented by $64$ characters. The third line is the Initialization Vector ($16$ bytes). The fourth line is the B1 Nonce ($13$ bytes). The fifth line is the B2 Nonce ($15$ bytes). The sixth line is the A0 Nonce ($14$ bytes). The seventh line is the initial value for the counter ($2$ bytes).

After reading those initial parameters, the subsequent lines will be one byte commands that you will encrypt using CCM and calculate the CBC-MAC for.

Output

For each one byte command input, output the encrypted command byte followed by the $4$ bytes of the tag.

Sample Input 1 Sample Output 1
65
1042e7e22dc64b089be48c2b9f31e8ac68b153d5a13843b3b490613efb8e81dc
095f272c79d7f9ac3b02b4ba9a70ab00
00040100000000000000000000
000000000000000000000000000000
01008d493b30ae8b3c9696766cfa
2c43
bc
23
9a
23
bc
56
23
c9c76fd885
ef61ff2eb4
20cae56e04
4f0ef4b9f0
babaab02f3
a85aa99be6
7b8dcd3688

Please log in to submit a solution to this problem

Log in