Simple insecure two-way data “obfuscation”?

后端 未结 17 1389
别跟我提以往
别跟我提以往 2020-11-22 01:10

I\'m looking for very simple obfuscation (like encrypt and decrypt but not necessarily secure) functionality for some data. It\'s not mission critical. I need something to k

17条回答
  •  无人及你
    2020-11-22 01:34

    I changed this:

    public string ByteArrToString(byte[] byteArr)
    {
        byte val;
        string tempStr = "";
        for (int i = 0; i <= byteArr.GetUpperBound(0); i++)
        {
            val = byteArr[i];
            if (val < (byte)10)
                tempStr += "00" + val.ToString();
            else if (val < (byte)100)
                tempStr += "0" + val.ToString();
            else
                tempStr += val.ToString();
        }
        return tempStr;
    }
    

    to this:

        public string ByteArrToString(byte[] byteArr)
        {
            string temp = "";
            foreach (byte b in byteArr)
                temp += b.ToString().PadLeft(3, '0');
            return temp;
        }
    

提交回复
热议问题