internal FPE_Encryptor(byte[] key, BigInteger n, byte[] tweak) { mac = new System.Security.Cryptography.HMACSHA256(key); mac.Initialize(); byte[] n_bin = n.encode(); if (n_bin.Length > MAX_N_BYTES) { throw new Exception("N is too large for FPE encryption"); } var ms = new MemoryStream(); ms.update_be(n_bin.Length); ms.update(n_bin); ms.update_be(tweak.Length); ms.update(tweak); mac_n_t = mac.ComputeHash(ms.ToArray()); }