I was reading through this paper and came across (pg. 11 of PDF, 5 of paper) the right_encode(x) and left_encode(x) pseudo-code sections. These contained this:

Let $x_1,x_2,\ldots, x_n$ be the base-256 encoding of $x$ satisfying: $x = \Sigma \;2^{8(n-i)} x_i$, for $i = 1 $ to $n$.

What does this mean the algorithm does?

  • $\begingroup$ Generally speaking NIST algorithm documentation can be an exquisitely choreographed shit show, and I'm not saying they have an easy job by any means. I would start here and here to get a grasp on what the conversions are doing at the bit level. $\endgroup$ – Q-Club Jan 10 '18 at 5:05

It's simply separating an integer into bytes with naive encoding. This is directly the represntation of the number, before padding length encoding etc. Think of binary representation of the number and group the bits into bytes. Those bytes are the Xi values. With X1 being the most significant and Xn being least significant.

| improve this answer | |
  • 3
    $\begingroup$ I assume "naive encoding" means big endian here? $\endgroup$ – Aemyl Jan 10 '18 at 6:49
  • $\begingroup$ Could you elaborate on the use of "etc." in your answer, I'm trying to put this into python right now and if this gets accepted before it's done I'm flipping my desk $\endgroup$ – Q-Club Jan 10 '18 at 7:03
  • $\begingroup$ Etc. Is becsuse it's a list of things which didn't happen. Obviously I can't make a comprehensive list of of things which don't happen with this definition. $\endgroup$ – Meir Maor Jan 10 '18 at 13:16
  • $\begingroup$ @ColinO'Neil IDK if you're done but you might need to flip your desk $\endgroup$ – user54972 Jan 10 '18 at 21:12
  • $\begingroup$ @codegreen Blast! Trying is the first step towards failure. $\endgroup$ – Q-Club Jan 11 '18 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy