/// <summary> /// Retrieve a parameter set by its identity code /// </summary> /// /// <param name="OId">The 3 byte parameter set identity code</param> /// /// <returns>A populated parameter set</returns> /// /// <exception cref="RLWEException">Thrown if an invalid or unknown OId is used.</exception> public static RLWEParameters FromId(byte[] OId) { if (OId == null) { throw new RLWEException("RLWEParamSets:FromId", "OId can not be null!", new ArgumentNullException()); } if (OId.Length != 3) { throw new RLWEException("RLWEParamSets:FromId", "OId must be 3 bytes in length!", new ArgumentOutOfRangeException()); } if (OId[0] != 2) { throw new RLWEException("RLWEParamSets:FromId", "OId is not a valid RLWE parameter id!", new ArgumentException()); } if (OId[2] == 0) { return((RLWEParameters)RLWEN256Q7681.Clone()); } else if (OId[2] == 1) { return((RLWEParameters)RLWEN512Q12289.Clone()); } throw new RLWEException("RLWEParamSets:FromId", "OId does not identify a valid param set!", new ArgumentOutOfRangeException()); }
/// <summary> /// Retrieve a parameter set by its enumeration name /// </summary> /// /// <param name="Name">The enumeration name</param> /// /// <returns>A populated parameter set</returns> /// /// <exception cref="RLWEException">Thrown if an invalid or unknown parameter name is used.</exception> public static RLWEParameters FromName(RLWEParamNames Name) { switch (Name) { case RLWEParamNames.N256Q7681: return((RLWEParameters)RLWEN256Q7681.Clone()); case RLWEParamNames.N512Q12289: return((RLWEParameters)RLWEN512Q12289.Clone()); default: throw new RLWEException("RLWEParamSets:FromName", "The enumeration name is unknown!", new ArgumentException()); } }