How to determine UUDecoding method needed?

291 Views Asked by At

I'm communicating to a device that returns uuencoded data:

ASCII: EZQAEgETAhMQIBwIAUkAAABj

HEX: 45-5A-51-41-45-67-45-54-41-68-4D-51-49-42-77-49-41-55-6B-41-41-41-42-6A

The documentation for this device states the above is uuencoded but I can't figure out how to decode it. The final result won't be a human readable string but the first byte reveals the number of bytes for the following product data. (Which would be 23 or 24?)

I've tried using Crypt2 to decode it; it doesn't seem to match 644, 666, 744 modes.

I've tried to hand write it out following the Wiki: https://en.wikipedia.org/wiki/Uuencoding#Formatting_mechanism

Doesn't make sense! How do I decode this uuencoded data?

2

There are 2 best solutions below

2
On BEST ANSWER

I agree with @canton7 that it looks like it's base64 encoded. You can decode it like this

byte[] decoded = Convert.FromBase64String("EZQAEgETAhMQIBwIAUkAAABj");

and if you want, you can print the hex values like this

Console.WriteLine(BitConverter.ToString(decoded));

which prints

11-94-00-12-01-13-02-13-10-20-1C-08-01-49-00-00-00-63
1
On

As @HansKilian says in the comments, this is not uuencoded.

If you base64-decode it you get (in hex):

11 94 00 12 01 13 02 13 10 20 1c 08 01 49 00 00 00 63

The first number, 17 in decimal, is the same as the number of bytes following it, which matches:

The final result won't be a human readable string but the first byte reveals the number of bytes for the following product data.

(@HansKilian made the original call that it was base64-encoded. This answer provides confirmation of that by looking at the first decoded byte, but please accept his answer)