I am trying to implement Keccak in Java for my school work. And I am getting stuck in two places:
On the summary page the padding is shown as
P = M || 0x01 || 0x00 || … || 0x00
P = P xor (0x00 || … || 0x00 || 0x80)However on the specification page section 1.1.2 they mention the variable rate padding as 10*1.
The way I read it, to prepare message for absorption phase, you cut your message into pieces of size
r
(bit rate). To get message length multiple ofr
you would append or concatenate the message with just, (for simplicity I am considering just bytes) in case just 1 byte padding required it will be0x81
. And if more than one byte required then it would be0x80...0x01
. So my padding implementation would be something likeP = M || 0x80...01
Where am I reading the specification in wrong way?
How is the placement of the bits in the state? I mean if I have a message of say 2 bits, then my bit goes to state position
S[0][0][0]
, but then where should I place the next bit in the same row that isS[0][1][0]
or in the same lane that isS[0][0][1]
. I would have assumed to go with placing the bit in next cell in the row, and then when you are finished with bits from one slice, then you again start with[0][0]
position in next slice. But the way most of the functions are defined with respect to slices, makes me think, it could be other way around. I am unable to find in specification, where they clearly mention this.
Please just point me to places in specification which can resolve my confusion. Thanks.