Skip to content
C#
  public static byte[] KeyGear(byte[] key, byte[] source)
    {
        var keyLength = key.Length;
        var kindex = 0;
        var index = 0;
        foreach (var b in source)
        {
            var k = key[kindex];
            source[index] = Convert.ToByte(k ^ b);
            if (kindex + 1 >= keyLength) kindex = 0;
            else
            {
                kindex++;
            }
            index++;
        }
        return source;
    }

2byte的Key,72byte的数据内容,20W次运算,约1.5s

转换自: https://www.cnblogs.com/atwind/archive/2013/03/22/2976056.html