Exemplo n.º 1
0
        public uint ReadOffset()
        {
            var offset = (uint)BaseStream.Position;

            offset  = (offset - FStart) ^ uint.MaxValue;
            offset *= Hash;
            offset -= CryptoConstants.WzOffsetConstant;
            offset  = CryptoConstants.RotateLeft(offset, (byte)(offset & 0x1F));
            var encryptedOffset = ReadUInt32();

            offset ^= encryptedOffset;
            offset += FStart * 2;
            return(offset);
        }
Exemplo n.º 2
0
 public static WzMutableKey GenerateWzKey(byte[] WzIv)
 {
     return(new WzMutableKey(WzIv, CryptoConstants.GetTrimmedUserKey()));
 }
Exemplo n.º 3
0
 public static WzMutableKey GenerateWzKey(byte[] wzIv) =>
 new WzMutableKey(wzIv, CryptoConstants.GetTrimmedUserKey());
Exemplo n.º 4
0
 public static byte[] GenerateWzKey(byte[] WzIv)
 {
     return(GenerateWzKey(WzIv, CryptoConstants.getTrimmedUserKey()));
 }
Exemplo n.º 5
0
 public WzBinaryReader(Stream input, byte[] wzIv)
     : base(input)
 {
     WzKey = CryptoConstants.GenerateWzKey(wzIv);
 }
Exemplo n.º 6
0
 public WzBinaryReader(Stream input, WzMapleVersion mapleVersion)
     : base(input)
 {
     WzKey = new WzMutableKey(mapleVersion.EncryptionKey(), CryptoConstants.GetTrimmedUserKey(mapleVersion));
 }
Exemplo n.º 7
0
 public WzBinaryReader(Stream input, byte[] WzIv)
     : base(input)
 {
     WzKey = new WzMutableKey(WzIv, CryptoConstants.GetTrimmedUserKey());
 }
Exemplo n.º 8
0
 /// <summary>
 ///   Encrypts data with AES and updates the IV
 /// </summary>
 /// <param name="data"> The data to crypt </param>
 public void Crypt(byte[] data)
 {
     AESEncryption.AESCrypt(IV, data, data.Length, CryptoConstants.GetTrimmedUserKey());
     UpdateIV();
 }