/// <summary> /// Initializes a new instance of Crypto with the specified seed /// </summary> /// <param name="forServer">True if this instance will be responsible for packets /// sent by the server</param> public MabiCrypto(uint seed, bool forServer) { this.Seed = seed; this.ForServer = forServer; var keyGen = new MabiKeystreamGenerator(seed); _aesEngine = new MabiAesEngine(forServer, keyGen.AesKey); _mabiCipher = new MabiCipherEngine(keyGen); }
/// <summary> /// Initializes a new instance of Crypto with the specified seed /// </summary> /// <param name="forServer">True if this instance will be responsible for packets /// sent by the server</param> public MabiCrypto(uint seed, bool forServer) { this.Seed = seed; this.ForServer = forServer; var keyGen = new MabiKeystreamGenerator(seed); _aesEngine = new MabiAesEngine(forServer, keyGen.AesKey); _mabiCipher = new MabiCipherEngine(keyGen); }
public MabiCipherEngine(MabiKeystreamGenerator keyGen) { _keyGen = keyGen; _keystream = new byte[128]; for (var i = 31; i >= 0; i--) { BitConverter.GetBytes(_keyGen.GetNextKey()).CopyTo(_keystream, i * 4); } _idx = 31; }
public MabiCipherEngine(MabiKeystreamGenerator keyGen) { _keyGen = keyGen; _keystream = new byte[128]; for (var i = 31; i >= 0; i--) { BitConverter.GetBytes(_keyGen.GetNextKey()).CopyTo(_keystream, i * 4); } _idx = 31; }