In my case the story continued for around 2 hours. Yesterday I was trying to implement something from a given SPEC, and tried to match my output (from Rust) with the output from the Python code written by Dr. Fett.
I had to get the JSON encoding from an ordered Array (in Python it is a simple list), say
["kushal", "das"], and get the
base64urlencode(sha256sum(JSON_ENCODED_STRING)) in Rust using serde_json.
Let us see what the encoded string looks like:
And the final checksum is
But, the reference implementation in Python has the checksum as
It took me a few hours to notice the space after comma in the JSON encoded string from Python:
This is due to the following line from JSON spec
Insignificant whitespace is allowed before or after any of the six structural characters.
Yes, I know I should have known better, and read the original spec properly. But, in this case I learned it in the hard way.