public void CreateTest() { EncryptionParameters encParams = new EncryptionParameters(SchemeType.BFV); Assert.IsNotNull(encParams); Assert.AreEqual(SchemeType.BFV, encParams.Scheme); EncryptionParameters encParams2 = new EncryptionParameters(SchemeType.CKKS); Assert.IsNotNull(encParams2); Assert.AreEqual(SchemeType.CKKS, encParams2.Scheme); EncryptionParameters encParams3 = new EncryptionParameters(SchemeType.CKKS); Assert.IsNotNull(encParams3); Assert.AreEqual(SchemeType.CKKS, encParams3.Scheme); EncryptionParameters copy = new EncryptionParameters(encParams); Assert.AreEqual(SchemeType.BFV, copy.Scheme); Assert.AreEqual(encParams, copy); Assert.AreEqual(encParams.GetHashCode(), copy.GetHashCode()); EncryptionParameters third = new EncryptionParameters(SchemeType.CKKS); third.Set(copy); Assert.AreEqual(SchemeType.BFV, third.Scheme); Assert.AreEqual(encParams, third); Assert.AreEqual(encParams.GetHashCode(), third.GetHashCode()); }
public void EncryptionParametersCompareNET() { var parms1 = new EncryptionParameters(); parms1.NoiseStandardDeviation = 3.19; parms1.CoeffModulus = new List <SmallModulus> { DefaultParams.SmallMods30Bit(0) }; parms1.PlainModulus = 1 << 6; parms1.PolyModulus = "1x^64 + 1"; var parms2 = new EncryptionParameters(parms1); Assert.IsTrue(parms1.Equals(parms2)); var parms3 = new EncryptionParameters(); parms3.Set(parms2); Assert.IsTrue(parms3.Equals(parms2)); parms3.CoeffModulus = new List <SmallModulus> { DefaultParams.SmallMods30Bit(1) }; Assert.IsFalse(parms3.Equals(parms2)); parms3.Set(parms2); Assert.IsTrue(parms3.Equals(parms2)); parms3.CoeffModulus = new List <SmallModulus> { DefaultParams.SmallMods30Bit(0), DefaultParams.SmallMods30Bit(1) }; Assert.IsFalse(parms3.Equals(parms2)); parms3.Set(parms2); parms3.PolyModulus = "1x^128 + 1"; Assert.IsFalse(parms3.Equals(parms1)); parms3.Set(parms2); parms3.PlainModulus = (1 << 6) + 1; Assert.IsFalse(parms3.Equals(parms2)); parms3.Set(parms2); parms3.NoiseStandardDeviation = 3.18; Assert.IsFalse(parms3.Equals(parms2)); parms3.Set(parms2); parms3.PolyModulus = "1"; parms3.PolyModulus = "1x^128 + 1"; parms3.PolyModulus = "1x^64 + 1"; Assert.IsTrue(parms3.Equals(parms1)); parms3.Set(parms2); parms3.CoeffModulus = new List <SmallModulus> { 2 }; parms3.CoeffModulus = new List <SmallModulus> { DefaultParams.SmallMods50Bit(0) }; parms3.CoeffModulus = parms2.CoeffModulus; Assert.IsTrue(parms3.Equals(parms2)); }