Esempio n. 1
0
        public static byte[] EncryptSave(byte[] Data)
        {
            List <byte> byteList = new List <byte>();

            byteList.AddRange((IEnumerable <byte>)((IEnumerable <byte>)Data).ToList <byte>().GetRange(0, 8).ToArray());
            int StartOffset1 = 8;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.EncryptSaveBlock(Data, StartOffset1, 248));
            int StartOffset2 = StartOffset1 + 248;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.EncryptSaveBlock(Data, StartOffset2, 768));
            int StartOffset3 = StartOffset2 + 768;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.EncryptSaveBlock(Data, StartOffset3, 1024));
            int StartOffset4 = StartOffset3 + 1024;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.EncryptSaveBlock(Data, StartOffset4, 5632));
            int StartOffset5 = StartOffset4 + 5632;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.EncryptSaveBlock(Data, StartOffset5, 256));
            int StartOffset6 = StartOffset5 + 256;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.EncryptSaveBlock(Data, StartOffset6, 3072));
            int num = StartOffset6 + 3072;

            return(byteList.ToArray());
        }
Esempio n. 2
0
        public static byte[] DecryptSave(byte[] Data)
        {
            List <byte> byteList = new List <byte>();

            byteList.AddRange((IEnumerable <byte>)((IEnumerable <byte>)Data).ToList <byte>().GetRange(0, 8).ToArray());
            int StartOffset1 = 8;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset1, 248, 1498630990U));
            int StartOffset2 = StartOffset1 + 248;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset2, 768, 1296386894U));
            int StartOffset3 = StartOffset2 + 768;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset3, 1024, 1346849614U));
            int StartOffset4 = StartOffset3 + 1024;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset4, 5632, 1096043342U));
            int StartOffset5 = StartOffset4 + 5632;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset5, 256, 1380797262U));
            int StartOffset6 = StartOffset5 + 256;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset6, 3072, 1279675214U));
            int StartOffset7 = StartOffset6 + 3072;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset7, 2816, 1162234702U));
            int StartOffset8 = StartOffset7 + 2816;

            byteList.AddRange((IEnumerable <byte>)MKDS_Const.DecryptSaveBlock(Data, StartOffset8, 2816, 1162234702U));
            int num = StartOffset8 + 2816;

            return(byteList.ToArray());
        }
Esempio n. 3
0
 private static byte[] DecryptSaveBlock(
     byte[] Data,
     int StartOffset,
     int Length,
     uint Signature)
 {
     return(MKDS_Const.DecryptSaveBlock(Data, StartOffset, Length, MKDS_Const.GetInitValue(Bytes.Read4BytesAsUInt32(Data, StartOffset), Signature)));
 }