Xoring Strings with different length problem RRS feed

  • Question

  • User1455977419 posted

    How to Xor Two strings

    Hi All

    I have

    StringA = "1234567890ABCDEFNOPQR";

    StringB ="FEDCBA0987654321";

    is there anyone can help me? or there is better way in C# to XOR two strings??

    Thank you very much

    Sunday, January 22, 2017 9:02 PM

All replies

  • User-1838255255 posted

    Hi tahahamzah,

    According to your description, as far as I know, about how to use XOR operator, please refer to this link that contain a sample,

    C# program that uses XOR operator


    About how to use XOR operator with different length strings, you could choose to use completion string with zero or use loop method etc.


    string a="123";

    string b="23456"

    1. check two strings length.

    2. add zero or loop:

        a="00123" or a="12312"

    3. then use XOR operator.

    Best Regards,

    Eric Du

    Monday, January 23, 2017 6:49 AM