Ejemplo n.º 1
0
 /// <summary>
 /// Creates several prime number Modulus elements that can be used as
 /// PlainModulus encryption parameters, each supporting batching with a given
 /// PolyModulusDegree.
 /// </summary>
 /// <param name="polyModulusDegree">The value of the PolyModulusDegree
 /// encryption parameter</param>
 /// <param name="bitSizes">The bit-lengths of the primes to be generated</param>
 /// <exception cref="ArgumentException">if polyModulusDegree is not
 /// a power-of-two or is too large</exception>
 /// <exception cref="ArgumentException">if bitSizes is too large or if its
 /// elements are out of bounds</exception>
 /// <exception cref="InvalidOperationException">if not enough suitable primes could be found</exception>
 static public IEnumerable <Modulus> Batching(
     ulong polyModulusDegree, IEnumerable <int> bitSizes)
 {
     return(CoeffModulus.Create(polyModulusDegree, bitSizes));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a prime number Modulus for use as PlainModulus encryption
 /// parameter that supports batching with a given PolyModulusDegree.
 /// </summary>
 /// <param name="polyModulusDegree">The value of the PolyModulusDegree
 /// encryption parameter</param>
 /// <param name="bitSize">The bit-length of the prime to be generated</param>
 /// <exception cref="ArgumentException">if polyModulusDegree is not
 /// a power-of-two or is too large</exception>
 /// <exception cref="ArgumentException">if bitSize is out of bounds</exception>
 /// <exception cref="InvalidOperationException">if a suitable prime could not be found</exception>
 static public Modulus Batching(ulong polyModulusDegree, int bitSize)
 {
     return(CoeffModulus.Create(
                polyModulusDegree,
                new int[] { bitSize }).First());
 }