I am working with a Linux guy at work (I work on Windows). He sends me a base64 string which I need to turn into a byte array using PowerShell. This byte array needs to duplicate the bytes he originally started with (he is using Phyton).
So basically, he takes some data and converts it to base64 string, then I need to take the base64 string and convert back to bytes so we end up with the same bytes. (As latter I need to check a signed digest of these bytes, not relevant for now.)
Therefore, let us say he sends me the following base64 string:
U29tZSBEYXRh
I do the following
[byte[]][char[]]"U29tZSBEYXRh"
85
50
57
116
90
83
66
69
89
88
82
104
but he says my output is an ASCII code representation of the string and not the actual bytes (he thinks the bytes should be returned as non-sense to the screen e.g. unprintable characters as it were).
Am I getting a genuine byte array of the input data or not?
Use System.Convert.FromBase64String
:
[System.Convert]::FromBase64String("U29tZSBEYXRh")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With