-1
byte[]cipherbytes = Encoding.ASCII.GetString(label6.Text);
System.IO.MemoryStream ms = new System.IO.MemoryStream(cipherbytes);
Bob Kaufman
  • 12,864
  • 16
  • 78
  • 107
Sam7382
  • 3
  • 2

1 Answers1

0

To encode the string with a certain encoding, call Encoding.<YourEncoding>.GetBytes() on, not GetString(), this function is for returning a string given the byte[] representation of it. A possible Encoding could e.g. be ASCII or UTF8 encoding.

byte[] cipherbytes = System.Text.Encoding.ASCII.GetBytes(label6.Text);

See also: How do I get a consistent byte representation of strings in C# without manually specifying an encoding?, Encoding.ASCII.GetBytes()

Community
  • 1
  • 1
big mack
  • 111
  • 6