I know it’s a very silly problem as I’m still newbie.
Case :
String A : An output string from an encryption algorithm ( contains special characters )
String B : An output string from a hash function of String A ( contains special characters )
String C = A + "|" + B;
Problem :
I want to send them together from sender as String C so that I can Separate them in receiver
But String A & B may contains my separator “|”
So what do you suggest for me ? [ C# ]
One option would be to convert the output from the encryption tool (which hopefully returns raw bytes) into something like Base64 using the Convert.ToBase64String function, which should be safe to use “|” with. You lose out on space efficiency though, since Base64 wastes a good amount of space, but if you’re dealing with small data you’d be ok.
If your encryption code does/can not return bytes, you’d have to convert it to bytes first using the appropriate encoder, i.e. Encoding.ASCII.GetBytes() if your string is in ASCII encoding.