SHA3 the Left & Right Encode Functions In this paper (Section 2.3.1, Pg.5), I came across the left_encode and right_encode functions, and I have some questions about the functions:


What is meant by the base256 encoding of an integer?
Do $x_1,x_2,\ldots,x_n$ all contain the same bytes, or do they contain different bytes split across them?
Does enc8 effectively mean little-endian?
After theenc8 bytes are concatenated, are they transformed back into a number or binary or...?
What is meant by the base256 encoding of an integer?
  


It splits an integer $x$ into bytes, a byte is 8-bit that can represent 256 numbers. That is why actually $n$ is set as the smallest positive integer satisfying $2^{8n} &gt; x$. The bytes are little-endian encoded.


  
  Do $x_1,x_2,\ldots, x_n$ all contain the same bytes, or do they contain different bytes split across them?
  


No, the x is split into bytes.


  
  Does enc8 effectively mean big-endian?
  


A byte has no little-endian or big-endian encodings. Here, it is just a byte encoding but in reverse. Second steps do the little-endian. In the end, all bits are reversed. See a bigger example below.


  
  After the enc8 bytes are concatenated, are they transformed back into a number or binary or...?
  


It is a byte array and in general in cryptographic implementations, the programming codes are processing with byte arrays. The output of the hash function will be byte to. It is up to you to convert into hex or base64.



A nice example from cryptologie.net

left_encode:

            0001 0000 | 0011 0001 | 0111 1110 input
            0111 1110 | 1000 1100 | 0000 1000 value reversed
1100 0000 | 0111 1110 | 1000 1100 | 0000 1000 length encoded. the size 3 in reverse


right_encode:

0001 0000 | 0011 0001 | 0111 1110               input
0111 1110 | 1000 1100 | 0000 1000               value reversed
0111 1110 | 1000 1100 | 0000 1000 | 1100 0000   length encoded