1

I'm trying to send a client to a URL on their accounting system for a specific account. The URL format is:

https://accountingsystem.com/Edit/CustomerEdit.aspx?CustomerId=MwA0ADEANQA4ADYAMgA=-MzQxNTg2Mg==

The Customer ID is 3415862, which when encoded as Base64, does indeed give me MzQxNTg2Mg==. However, I don't know where MwA0ADEANQA4ADYAMgA=- comes from, or how to calculate it. What's also confusing is this:

$ echo MwA0ADEANQA4ADYAMgA=-MzQxNTg2Mg== | base64 -D -d
<Info>: Read 34 bytes.
<Info>: Decoded to 14 bytes.
<Info>: Wrote 14 bytes.
3415862%

$ echo MwA0ADEANQA4ADYAMgA= | base64 -D -d
<Info>: Read 21 bytes.
<Info>: Decoded to 14 bytes.
<Info>: Wrote 14 bytes.
3415862%

$ echo MzQxNTg2Mg== | base64 -D -d
<Info>: Read 13 bytes.
<Info>: Decoded to 7 bytes.
<Info>: Wrote 7 bytes.
3415862%

Can someone elucidate this conundrum?

In anticipation, J

1 Answers1

2

There is a difference:

MwA0ADEANQA4ADYAMgA= decodes to hexadecimal 3300340031003500380036003200

and

MzQxNTg2Mg== decodes to hexadecimal 33343135383632

While both result to the string 3415862, the difference is that the first one is encoded from a UTF-16 string and the second one is encoded from UTF-8 or ASCII.

This said, I have no idea why they would combine both formats in one value. Maybe they just use the '-' sign to indicate that both formats are allowed.

huysentruitw
  • 27,376
  • 9
  • 90
  • 133