コード例 #1
0
ファイル: PngCloak.cs プロジェクト: bcdev-com/liveconnect
 public static byte[] Inject(byte[] png, byte[] data)
 {
     VerifyPng(png);
     var size = new byte[] { (byte)((data.Length >> 24) & 0xff), (byte)((data.Length >> 16) & 0xff),
                             (byte)((data.Length >> 8) & 0xff),  (byte)(data.Length & 0xff) };
     var crc = new Crc32().ComputeHash(data);
     var result = new byte[png.Length + size.Length + tag.Length + data.Length + crc.Length];
     var index = 0;
     png.CopyTo(result, index); index += png.Length - iend.Length;
     size.CopyTo(result, index); index += size.Length;
     tag.CopyTo(result, index); index += tag.Length;
     data.CopyTo(result, index); index += data.Length;
     crc.CopyTo(result, index); index += crc.Length;
     iend.CopyTo(result, index);
     return result;
 }