Search code examples
c#encodinguuencodeuudecode

How to determine UUDecoding method needed?


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?


Solution

  • 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