public void Collection() { ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi1 = new Multi(); multi1.ExtraProp = "extra1"; Multi multi2 = new Multi(); multi2.ExtraProp = "extra2"; Po po = new Po(); multi1.Po = po; multi2.Po = po; po.Set = new HashSet <Multi> { multi1, multi2 }; po.List = new ArrayList(); po.List.Add(new SubMulti()); object id = s.Save(po); Assert.IsNotNull(id); t.Commit(); s.Close(); s = OpenSession(); t = s.BeginTransaction(); po = (Po)s.Load(typeof(Po), id); Assert.AreEqual(2, po.Set.Count); Assert.AreEqual(1, po.List.Count); s.Delete(po); Assert.AreEqual(0, s.CreateQuery("from s in class Top").List().Count); t.Commit(); s.Close(); }
void Start() { _multi = this.GetComponentInParent <Multi> (); _ik_armLeft = _multi.hashMap.GetTransform(eHashIdx.Bone_Arm_Left).GetComponent <IK2Chain> (); _ik_armRight = _multi.hashMap.GetTransform(eHashIdx.Bone_Arm_Right).GetComponent <IK2Chain> (); }
private void button16_Click(object sender, EventArgs e) { segundo = double.Parse(tb_numeros.Text); double Sum; double Res; double Multi; double Div; switch (operador) { case "+": Sum = obj.Somar((primeiro), (segundo)); tb_numeros.Text = Sum.ToString(); break; case "-": Res = obj2.Resto((primeiro), (segundo)); tb_numeros.Text = Res.ToString(); break; case "*": Multi = obj3.Multiplicar((primeiro), (segundo)); tb_numeros.Text = Multi.ToString(); break; case "/": Div = obj4.Dividir((primeiro), (segundo)); tb_numeros.Text = Div.ToString(); break; } }
private void butonmulti_Click(object sender, EventArgs e) { ingresoM = new Multi(); ingresoM.V5 = double.Parse(textboxA.Text); ingresoM.V6 = double.Parse(textbox2.Text); label3.Text = ingresoM.CalcularM().ToString(); }
/// <summary> /// Called by Phoenix.Initialize(). /// </summary> /// <param name="param">Client directory.</param> internal static void Load(object param) { string dir = param.ToString(); try { Trace.WriteLine("Loading ultima data files started..", "MulLib"); tiledata = TileData.Load(Path.Combine(dir, "tiledata.mul")); hues = Hues.Load(Path.Combine(dir, "hues.mul")); radarCol = RadarCol.Load(Path.Combine(dir, "radarcol.mul")); skills = Skills.Load(Path.Combine(dir, "skills.idx"), Path.Combine(dir, "skills.mul")); art = Art.Load(Path.Combine(dir, "artidx.mul"), Path.Combine(dir, "art.mul"), MulFileAccessMode.ReadOnly); multi = Multi.Load(Path.Combine(dir, "multi.idx"), Path.Combine(dir, "multi.mul"), MulFileAccessMode.ReadOnly); Trace.WriteLine("Loading ultima data files finished.", "MulLib"); } catch (Exception e) { string msg = String.Format("Unable to load ultima data files. Program will be terminated. Exception:\r\n{0}", e); Trace.WriteLine(msg, "MulLib"); MessageBox.Show(msg, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Core.Terminate(); } try { SyncEvent.Invoke(Loaded, null, EventArgs.Empty); } catch (Exception e) { Trace.WriteLine("Unhandled exception in DataFiles.Loaded event. Exception:\r\n" + e.ToString(), "MulLib"); } }
private void InternalCheckCellsInMemory() { for (int y = -c_CellsInMemory; y <= c_CellsInMemory; y++) { int cellY = (CenterPosition.Y / 8) + y; if (cellY < 0) { cellY += Height / 8; } for (int x = -c_CellsInMemory; x <= c_CellsInMemory; x++) { int cellX = (CenterPosition.X / 8) + x; if (cellX < 0) { cellX += Width / 8; } int cellIndex = (cellY % c_CellsInMemorySpan) * c_CellsInMemorySpan + cellX % c_CellsInMemorySpan; if (m_Blocks[cellIndex] == null || m_Blocks[cellIndex].X != cellX || m_Blocks[cellIndex].Y != cellY) { if (m_Blocks[cellIndex] != null) { m_Blocks[cellIndex].Unload(); } m_Blocks[cellIndex] = new MapBlock(cellX, cellY); m_Blocks[cellIndex].Load(m_MapData, this); Multi.AnnounceMapBlockLoaded(m_Blocks[cellIndex]); } } } }
int readMulti(string[] str, int i, Chapter cha) { int multiSize = 0; while (i < str.Length) { Multi sin = new Multi(); sin.name = str[i]; if (!Char.IsDigit(str[i][0])) { cha.multiSize = multiSize; return(i); } int where = sin.name.IndexOf('.'); where++; sin.name = sin.name.Substring(where); Console.WriteLine(multiSize + " " + sin.name); sin.choice[0] = str[i + 1].Substring(str[i + 1].IndexOf('.') + 1); sin.choice[1] = str[i + 2].Substring(str[i + 2].IndexOf('.') + 1); sin.choice[2] = str[i + 3].Substring(str[i + 3].IndexOf('.') + 1); sin.choice[3] = str[i + 4].Substring(str[i + 4].IndexOf('.') + 1); i += 5; cha.multi[multiSize] = sin; multiSize++; } throw new Exception("read single error"); }
private void button3_Click(object sender, EventArgs e) { ingreso3 = new Multi(); ingreso3.Valor1 = double.Parse(textBox1.Text); ingreso3.Valor2 = double.Parse(textBox2.Text); label4.Text = ingreso3.calcular().ToString(); }
public void CalculateMultiTestStrong(double firstValue, double secondValue, double expected) { ITwoArgumentCalculator calculator = new Multi(); double result = calculator.Calculate(firstValue, secondValue); Assert.AreEqual(expected, result); }
private void InternalCheckCellsInMemory() { uint centerX = ((uint)CenterPosition.X / 8); uint centerY = ((uint)CenterPosition.Y / 8); for (int y = -c_CellsInMemory; y <= c_CellsInMemory; y++) { uint cellY = (uint)(centerY + y) % MapData.ChunkHeight; for (int x = -c_CellsInMemory; x <= c_CellsInMemory; x++) { uint cellX = (uint)(centerX + x) % MapData.ChunkWidth; uint cellIndex = (cellY % c_CellsInMemorySpan) * c_CellsInMemorySpan + (cellX % c_CellsInMemorySpan); if (m_Chunks[cellIndex] == null || m_Chunks[cellIndex].ChunkX != cellX || m_Chunks[cellIndex].ChunkY != cellY) { if (m_Chunks[cellIndex] != null) { m_Chunks[cellIndex].Unload(); } m_Chunks[cellIndex] = new MapChunk(cellX, cellY); m_Chunks[cellIndex].Load(MapData, this); // if we have a translator and it's not spring, change some statics! if (Season != Seasons.Spring && SeasonalTranslator != null) { SeasonalTranslator(m_Chunks[cellIndex], Season); } // let any active multis know that a new map chunk is ready, so they can load in their pieces. Multi.AnnounceMapChunkLoaded(m_Chunks[cellIndex]); } } } }
private void button3_Click(object sender, EventArgs e) { proceso = new Multi(); proceso.M1 = double.Parse(textBox1.Text); proceso.M2 = double.Parse(textBox2.Text); label3.Text = proceso.Calcular().ToString(); }
public void OnExit() { if (Multi != null) { Multi.stop(); } }
public ActionResult Index() { Multi objmulti = new Multi(); //List<Dinner> GetItem = new List<Dinner>(); //Lunch var tblfeature = context.Tblproducts.Where(a => a.FrontDisplay == "yes").ToList(); var lstfeature = new List <feature>(); foreach (var item in tblfeature) { lstfeature.Add(new feature() { Id = item.Productid, Name = item.Modelname, price = item.Price, image = item.Image, description = item.Description, }); } var tblLatest = context.Tblproducts.Take(5); var lstLatest = new List <Latest>(); foreach (var item in tblLatest) { lstLatest.Add(new Latest() { Id = item.Productid, Name = item.Modelname, price = item.Price, image = item.Image, description = item.Description }); } objmulti.Latest = lstLatest; objmulti.Feature = lstfeature; return(View(objmulti)); }
public ActionResult Create(Multi collection) { try { using (ContextBLL ctx = new ContextBLL()) { if (!ModelState.IsValid) { ViewBag.Roles = GetRoleItems(ctx); ViewBag.Races = GetRaceItems(ctx); ViewBag.Classes = GetClassItems(ctx); return(View(collection)); } int UserID = ctx.CreateUser(collection.UserName, collection.Email, collection.RoleID, collection.Password, collection.PasswordAgain, collection.NewRoleName); collection.UserID = ctx.CreateCharacter(UserID, collection.CharacterName, collection.ClassID, collection.RaceID, ctx.Roll(), ctx.Roll(), ctx.Roll(), ctx.Roll(), ctx.Roll(), ctx.Roll()); } return(RedirectToAction("Index", "User")); } catch (Exception ex) { ViewBag.Exception = ex; return(View("Error")); } }
static void Encode(BinaryWriter writer, Multi o) { EncodeID(writer, typeof(Multi)); Encode(writer, o.Preprocess); writer.Write(o.Count); for (int i = 0; i < o.Count; i++) { Encode(writer, o[i]); } for (int i = 0; i < o.Count; i++) { for (int j = 0; j < 101; j++) { writer.Write(o.GetFilter(i)[j]); } } writer.Write(o.Expanded.HasValue); if (o.Expanded.HasValue) { writer.Write(o.Expanded.Value); } writer.Write((int)o.Mode); }
public void Read(string ReceiveData) { switch (ReceiveData.Substring(0, 1)) { case "L": { durum = Convert.ToInt32(ReceiveData.Substring(1)); LampBtn_Click(null, null); break; } case "T": { TextBtn_Click(null, null); break; } case "D": { Multi.Write("L" + durum + ""); TextTxt_SelectionChanged(null, null); break; } } }
public static void Main(String[] args) { try { Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL); Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData); Easy easy1 = new Easy(); String s1 = (String)args[0].Clone(); easy1.SetOpt(CURLoption.CURLOPT_URL, args[0]); easy1.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf); easy1.SetOpt(CURLoption.CURLOPT_WRITEDATA, s1); Easy easy2 = new Easy(); String s2 = (String)args[1].Clone(); easy2.SetOpt(CURLoption.CURLOPT_URL, args[1]); easy2.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf); easy2.SetOpt(CURLoption.CURLOPT_WRITEDATA, s2); Multi multi = new Multi(); multi.AddHandle(easy1); multi.AddHandle(easy2); int stillRunning = 1; // call Multi.Perform right away (note ref qualifier) while (multi.Perform(ref stillRunning) == CURLMcode.CURLM_CALL_MULTI_PERFORM); while (stillRunning != 0) { multi.FDSet(); int rc = multi.Select(1000); // one second switch(rc) { case -1: Console.WriteLine("Multi.Select() returned -1"); stillRunning = 0; break; case 0: default: { while (multi.Perform(ref stillRunning) == CURLMcode.CURLM_CALL_MULTI_PERFORM); break; } } } // various cleanups multi.Cleanup(); easy1.Cleanup(); easy2.Cleanup(); Curl.GlobalCleanup(); } catch(Exception ex) { Console.WriteLine(ex); } }
private static List<cpolinom> Table(cpolinom p, cpolinom ir, Multi mul, int w) { List<cpolinom> table = new List<cpolinom>(); table.Add(p % ir); for (int i = 0; i < Math.Pow(2, w) - 2; i++) table.Add(mul(table[i], p) % ir); return table; }
private static List<cpolinom> SlideLRTable(cpolinom p, cpolinom ir, Multi mul, int power, int w) { List<cpolinom> table = new List<cpolinom>(); table.Add(BinaryLR(p, ir, mul, power)); for (int i = 0; i < power - 1; i++) table.Add(mul(table[i], p) % ir); return table; }
public ScoreScreen(Motus.TypeDePartie _type_partie) { typepartie = _type_partie; visualisation = true; ThemeColor(); TypePartie(typepartie); multi = new Multi(ApiKey, GameId); }
private static List<cpolinom> NAFLRTable(cpolinom p, cpolinom ir, Multi mul, int power, int w) { List<cpolinom> table = new List<cpolinom>(); for (int i = 1; i <= power; i += 2) table.Add(BinaryLR(p, ir, mul, i)); return table; }
public void MultipleCustom() { Multi one = new Multi(); Multi two = new Multi(); Assert.Equal(one.GetHashCode(), two.GetHashCode()); Assert.NotEqual(0, one.GetHashCode()); Assert.NotEqual(2, one.GetHashCode()); }
public ScoreScreen(Motus.TypeDePartie _type_partie, int score_joueur) { _score_joueur = score_joueur; typepartie = _type_partie; visualisation = false; ThemeColor(); TypePartie(typepartie); multi = new Multi(ApiKey, GameId); }
public void container_storage_services_has_targettype_of_gived_object_multiinstance() { IContainer container = ContainerFactory.Container(); Multi @object = new Multi(); exec(container, @object); Assert.NotNull(container.Storage.Services.GetServices().SingleOrDefault(x => x.Registration.TargetType == @object.GetType())); }
public CurlResponseStream(Multi multi, Easy easy) { if (multi == null) throw new ArgumentNullException ("multi"); else if (easy == null) throw new ArgumentNullException ("easy"); this.multi = multi; easy.WriteHandler = AppendBuffer; }
public void container_resolve_returns_other_instance_if_gived_type_has_flag_multiinstance() { IContainer container = ContainerFactory.Container(); object @object = new Multi(); exec(container, @object); object instance = container.Resolve(@object.GetType()); Assert.AreNotEqual(@object, instance); }
void Awake() { if (Instance) { Destroy(this); } else { Instance = this; } }
public void container_resolve_returns_not_null_of_multiinstance() { IContainer container = ContainerFactory.Container(); object @object = new Multi(); exec(container, @object); object instance = container.Resolve(@object.GetType()); Assert.NotNull(instance); }
private void Work_DoWork(object sender, DoWorkEventArgs e) { try { client = TcpDinle.AcceptTcpClient(); Multi multi = new Multi(); multi.Conn(client); } catch (Exception) { } }
public void MultiWithOnlySmallSatisfiedDependencyWorks() { IMutablePicoContainer pico = createPicoContainer(); pico.RegisterComponentImplementation(typeof(Multi)); pico.RegisterComponentImplementation(typeof(One)); pico.RegisterComponentImplementation(typeof(Three)); Multi multi = (Multi)pico.GetComponentInstance(typeof(Multi)); Assert.AreEqual("three one", multi.message); }
public static void ApplyThisAttributeValue(ref GameObjectData obj, ref PathOutline pO, string attribute, string value, float valueFloat) { Shapes?shape = null; if (attribute == "d") { D(ref obj, value, out shape); if (shape == null) { Multi.PathOutline(ref pO, value); } } if (shape != null) { obj.Shape = shape.Value; } switch (attribute) { case "x": case "cx": X(ref obj, valueFloat); break; case "y": case "cy": Y(ref obj, valueFloat); break; case "width": case "rx": sizeX(ref obj, valueFloat, attribute); break; case "height": case "ry": sizeY(ref obj, valueFloat, attribute); break; case "transform": translate(ref obj, value); break; case "r": size(ref obj, valueFloat); break; case "stroke": fill(ref obj, value); stroke(ref obj); break; case "stroke-width": strokeWidth(ref pO, valueFloat); break; case "fill": fill(ref obj, value); break; case "x1": x1(ref pO, valueFloat); break; case "x2": x2(ref pO, valueFloat); break; case "y1": y1(ref pO, valueFloat); break; case "y2": y2(ref pO, valueFloat); break; case "points": points(ref pO, value); break; case "style": style(ref obj, ref pO, value); break; } }
static void Main() { Multi <string> title = new Multi <string>(); title.Data = "연봉"; Multi <long> income = new Multi <long>(); income.Data = 100_000_000; Console.WriteLine($"{title.Data}: {income.Data:#,###}"); }
static T InternalCreateEntity <T>(Serial serial) where T : AEntity { AEntity e; Type t = typeof(T); switch (t.Name) { case "Item": e = new Item(serial, m_Model.Map); break; case "Container": e = new Container(serial, m_Model.Map); break; case "Mobile": e = new Mobile(serial, m_Model.Map); break; case "PlayerMobile": e = new PlayerMobile(serial, m_Model.Map); break; case "Corpse": e = new Corpse(serial, m_Model.Map); break; case "Multi": e = new Multi(serial, m_Model.Map); break; default: throw new Exception("Unknown addObject type!"); } if (e.Serial == EngineVars.PlayerSerial) { e.IsClientEntity = true; } // If the entities collection is locked, add the new entity to the queue. Otherwise // add it directly to the main entity collection. if (m_EntitiesCollectionIsLocked) { m_Entities_Queued.Add(e); } else { m_Entities.Add(e.Serial, e); } return((T)e); }
public void created_service_has_no_null_instance_multiinstance() { IContainer container = ContainerFactory.Container(); object @object = new Multi(); exec(container, @object); IService service = container.Storage.Services.GetServices().SingleOrDefault(x => x.Registration.TargetType == @object.GetType()); bool condition = service.Data.Instance != null; Assert.IsTrue(condition); }
protected void Calc_Click(object sender, EventArgs e) { Multi mult = Funcion.Nx2; double rest = Convert.ToDouble(Num.Text); double result = mult(rest); string a = Convert.ToString(result); Resultado.Text = a; Action<string> bitac = Funcion.bitacora; string hacerbitacora = String.Format("Se multiplica el numero {0} por 2 y da como resultado: {1}", rest, result); bitac(hacerbitacora); }
public EnumMultiFile Upload(MultiFile multifile, Multi multi) { filescount = 0; tempfiles = new List<T_SystemAccessorie>(); #region foreach (var item in multifile.Files) { // 上传文件。 try { var FileName = item.FileName; //获取上传文件的文件名,包括后缀 var ExtenName = Path.GetExtension(FileName); //获取扩展名 var filePath = HttpContext.Current.Request.MapPath("~/UpLoadFiles/" + multi.PathFile + ""); if (ExtenName != ".pdf") { return EnumMultiFile.alert; } var fileName = FileName.Substring(0, FileName.IndexOf('.')) + "_" + DateTime.Now.ToString("yyyyMMddhhmm") + ExtenName; var fileURL = Path.Combine(filePath, fileName); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } item.SaveAs(fileURL); filescount++; var tempfile = new T_SystemAccessorie { FileName = fileName, FilePath = fileURL, TableName = multi.TableName, ColName = multi.ColName, DataID = multi.NewID }; tempfiles.Add(tempfile); } catch (Exception) { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('上传文件失败!');", true); return EnumMultiFile.Ex; } } Add(tempfiles); return EnumMultiFile.Ok; #endregion }
public static cpolinom Point_Multiplication_Affine_Coord_19(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int A, int B, Inverse inv) { BigInteger[,] mas_k; mas_k = Convert_to_DBNS_1(n, A, B); int lastindex = mas_k.GetLength(0) - 1; cpolinom t = cpolinom.Copy(p); cpolinom res = new cpolinom("1", p.mod); for (int i = 0; i < mas_k[lastindex, 1]; i++) t = mul(t, t) % ir; for (int i = 0; i < mas_k[lastindex, 2]; i++) t = mul(t, mul(t, t)) % ir; if (mas_k[lastindex, 0] == -1) res = mul(res, inv(t, ir)) % ir; else if (mas_k[lastindex, 0] == 1) res = mul(res, t) % ir; for (int i = lastindex - 1; i >= 0; i--) { BigInteger u = mas_k[i, 1] - mas_k[i + 1, 1]; BigInteger v = mas_k[i, 2] - mas_k[i + 1, 2]; for (int j = 0; j < u; j++) t = mul(t, t) % ir; for (int j = 0; j < v; j++) t = mul(t, mul(t, t)) % ir; if (mas_k[i, 0] == -1) res = mul(res, inv(t, ir)) % ir; else if (mas_k[i, 0] == 1) res = mul(res, t) % ir; } return res; }
public static cpolinom Point_Multiplication_Affine_Coord_20(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int A, int B, Inverse inv) { BigInteger[,] mas_k; cpolinom t = cpolinom.Copy(p); cpolinom res = new cpolinom("1", p.mod); mas_k = Convert_to_DBNS_2(n, A, B); if (mas_k[0, 0] == -1) res = inv(t, ir); else if (mas_k[0, 0] == 1) res = t; for (int i = 0; i < mas_k.GetLength(0) - 1; i++) { BigInteger u = mas_k[i, 1] - mas_k[i + 1, 1]; BigInteger v = mas_k[i, 2] - mas_k[i + 1, 2]; for (int j = 0; j < u; j++) res = mul(res, res) % ir; for (int j = 0; j < v; j++) res = mul(res, mul(res, res)) % ir; if (mas_k[i+1, 0] < 0) res = mul(res, inv(t, ir)) % ir; else res = mul(res, t) % ir; } for (int i = 0; i < mas_k[mas_k.GetLength(0) - 1, 1]; i++) res = mul(res, res) % ir; for (int i = 0; i < mas_k[mas_k.GetLength(0) - 1, 2]; i++) res = mul(res, mul(res, res)) % ir; return res; }
protected override void Dispose(bool disposing) { base.Dispose (disposing); if (disposing && multi != null) { multi.Dispose (); multi = null; } }
public static cpolinom NAFBinaryLR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); cpolinom c = cpolinom.Copy(p); List<BigInteger> x = bif.NAF(n); for (int i = x.Count - 1; i > -1; i--) { res = mul(res, res) % ir; if (x[i] == 1) res = mul(res, c) % ir; else if (x[i] == -1) res = mul(res, inv(c, ir)) % ir; } return res; }
public static cpolinom meth7_2(cpolinom p, cpolinom ir, Multi mul, BigInteger n, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); cpolinom c = cpolinom.Copy(p); BigInteger k = n; while (k >= 1) { BigInteger temp = 0; if (k % 2 != 0) { temp = 2 - k % 4; k -= temp; } if (temp == 1) res = mul(res, c) % ir; else if (temp == -1) res = mul(res, inv(c, ir)) % ir; k = k / 2; c = mul(c, c) % ir; } return res; }
public static cpolinom Joye_double_and_add(cpolinom p, cpolinom ir, Multi mul, BigInteger n) { cpolinom res = new cpolinom("1", p.mod); cpolinom t = cpolinom.Copy(p); string Binary = bif.ToBin(n); for (int i = Binary.Length - 1; i >= 0 ; i--) { if (Binary[i] == '1') { res = mul(res, res) % ir; res = mul(res, t) % ir; } else { t = mul(t, t) % ir; t = mul(res, t) % ir; } } return res; }
public static cpolinom WindowLR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w) { List<cpolinom> table = Table(p, ir, mul, w); cpolinom res = new cpolinom("1", p.mod); List<string> bins = windows(bif.ToBin(n), w); for (int i = 0; i < bins.Count; i++) { for (int k = 0; k < w; k++) res = mul(res, res) % ir; int c = Convert.ToInt32(bins[i], 2); if (c != 0) res = mul(res, table[c - 1]) % ir; } return res; }
public static cpolinom DBNS2LR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, Inverse inv) { List<int[]> x = ToDBNS2LR(n); cpolinom res = cpolinom.Copy(p); for (int i = x.Count - 1; i > 0 ; i--) { for (int j = 0; j < x[i][1]; j++) res = mul(res, res) % ir; for (int j = 0; j < x[i][2]; j++) res = mul(res, mul(res, res)) % ir; if (x[i][0] == 1) res = mul(res, p) % ir; else if (x[i][0] == -1) res = mul(res, inv(p, ir)) % ir; } for (int j = 0; j < x[0][1]; j++) res = mul(res, res) % ir; for (int j = 0; j < x[0][2]; j++) res = mul(res, mul(res, res)) % ir; return res; }
public static cpolinom DBNS2RL(cpolinom p, cpolinom ir, Multi mul, BigInteger n, Inverse inv) { List<int[]> x = ToDBNS2RL(n); cpolinom res = new cpolinom("1", p.mod); cpolinom t = cpolinom.Copy(p); for (int i = x.Count - 1; i > -1; i--) { for (int j = 0; j < x[i][1]; j++) t = mul(t, t) % ir; for (int j = 0; j < x[i][2]; j++) t = mul(t, mul(t, t)) % ir; if (x[i][0] == 1) res = mul(res, t) % ir; else if (x[i][0] == -1) res = mul(res, inv(t, ir)) % ir; } return res; }
public static cpolinom DBNS1LR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int A, int B, Inverse inv) { return methods.Point_Multiplication_Affine_Coord_20(p, ir, mul, n, A, B, inv); }
public static cpolinom MontgomeryLadder(cpolinom p, cpolinom ir, Multi mul, BigInteger n) { cpolinom res = new cpolinom("1", p.mod); cpolinom t = cpolinom.Copy(p); string Binary = bif.ToBin(n); for (int i = 0; i < Binary.Length; i++) { if (Binary[i] == '0') { t = mul(t, res) % ir; res = mul(res, res) % ir; } else { res = mul(res, t) % ir; t = mul(t, t) % ir; } } return res; }
public static cpolinom NAFWindowRL(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); List<BigInteger> x = bif.NAF(n); int pow = (int)Math.Pow(2, w - 1); List<cpolinom> table = NAFRLTable(p, ir, mul, pow, w); for (int i = 1; i < pow; i += 2) table.Add(BinaryRL(p, ir, mul, i)); for (int i = 0; i < x.Count; i++) { if (x[i] > 0) res = mul(res, table[(int)(x[i] / 2)]) % ir; else if (x[i] < 0) res = mul(res, inv(table[(int)(-x[i] / 2)], ir)) % ir; for (int j = 0; j < table.Count; j++) table[j] = mul(table[j], table[j]) % ir; } return res; }
public static cpolinom AddSubLR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); cpolinom c = cpolinom.Copy(p); string BinaryT = bif.ToBin(3 * n); string BinaryN = bif.ToBin(n); while (BinaryN.Length < BinaryT.Length) BinaryN = "0" + BinaryN; for (int i = 0; i < BinaryN.Length - 1; i++) { res = mul(res, res) % ir; if (BinaryT[i] != '0' && BinaryN[i] == '0') res = mul(res, c) % ir; else if (BinaryT[i] == '0' && BinaryN[i] != '0') res = mul(res, inv(c, ir)) % ir; } return res; }
public static cpolinom SlideRL(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w) { int power = (int)Math.Pow(2, w - 1); List<cpolinom> table = SlideRLTable(p, ir, mul, power, w); cpolinom res = new cpolinom("1", p.mod); cpolinom temp = cpolinom.Copy(p); string binary = bif.ToBin(n); while(binary.Length > 0) { int index = binary.Length - 1; if (binary.Length < w || binary[index - w + 1] == '0') { if (binary[index] == '1') res = mul(res, temp) % ir; for (int j = 0; j < table.Count; j++) table[j] = mul(table[j], table[j]) % ir; temp = mul(temp, temp) % ir; binary = binary.Remove(index, 1); } else { int c = Convert.ToInt32(binary.Substring(index - w + 1, w), 2); res = mul(res, table[c - power]) % ir; temp = mul(temp, table[table.Count - 1]) % ir; for (int k = 0; k < w; k++) for (int j = 0; j < table.Count; j++) table[j] = mul(table[j], table[j]) % ir; binary = binary.Remove(index - w + 1, w); } } return res; }
public static cpolinom NAFBinaryRL(cpolinom p, cpolinom ir, Multi mul, BigInteger n, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); cpolinom c = cpolinom.Copy(p); List<BigInteger> x = bif.NAF(n); for (int i = 0; i < x.Count; i++) { if (x[i] == 1) res = mul(res, c) % ir; else if (x[i] == -1) res = mul(res, inv(c, ir)) % ir; c = mul(c, c) % ir; } return res; }
public static cpolinom WindowRL(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w) { List<cpolinom> table = Table(p, ir, mul, w); cpolinom res = new cpolinom("1", p.mod); List<string> bins = windows(bif.ToBin(n), w); for (int i = bins.Count - 1; i > -1; i--) { int c = Convert.ToInt32(bins[i], 2); if (c != 0) res = mul(res, table[c - 1]) % ir; for (int k = 0; k < w; k++) for (int j = 0; j < table.Count; j++) table[j] = mul(table[j], table[j])%ir; } return res; }
public static cpolinom NAFWindowLR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); List<BigInteger> x = bif.NAF(n); int pow = (int)Math.Pow(2, w - 1); List<cpolinom> table = NAFLRTable(p, ir, mul, pow, w); for (int i = x.Count - 1; i > -1 ; i--) { res = mul(res, res) % ir; if (x[i] > 0) res = mul(res, table[(int)(x[i] / 2)]) % ir; else if (x[i] < 0) res = mul(res, inv(table[(int)(-x[i] / 2)], ir)) % ir; } return res; }
public AnonymousClassArrayConstructor2(Multi enclosingInstance) { this.enclosingInstance = enclosingInstance; }
public static cpolinom BinaryLR(cpolinom p, cpolinom ir, Multi mul, BigInteger n) { cpolinom res = new cpolinom("1", p.mod); cpolinom t = cpolinom.Copy(p); string Binary = bif.ToBin(n); for (int i = 0; i < Binary.Length; i++) { res = mul(res, res) % ir; if (Binary[i] == '1') res = mul(t, res) % ir; } return res; }
public static cpolinom BinaryRL(cpolinom p, cpolinom ir, Multi mul, BigInteger n) { cpolinom res = new cpolinom("1", p.mod); cpolinom t = cpolinom.Copy(p); string Binary = bif.ToBin(n); for (int i = Binary.Length - 1; i >= 0; i--) { if (Binary[i] == '1') res = mul(t, res) % ir; t = mul(t, t) % ir; } return res; }
public static cpolinom SlideLR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w) { int power = (int)Math.Pow(2, w - 1); List<cpolinom> table = SlideLRTable(p, ir, mul, power, w); cpolinom res = new cpolinom("1", p.mod); string binary = bif.ToBin(n); while (binary.Length > 0) { if (binary.Length < w || binary[0] == '0') { res = mul(res, res) % ir; if (binary[0] == '1') res = mul(res, p) % ir; binary = binary.Remove(0, 1); } else { int c = Convert.ToInt32(binary.Substring(0, w), 2); for (int k = 0; k < w; k++) res = mul(res, res) % ir; res = mul(res, table[c - power]) % ir; binary = binary.Remove(0, w); } } return res; }
public static cpolinom wNAFSlideRL(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); List<BigInteger> x = bif.wNAF(n, w); int pow = 2 * ((int)Math.Pow(2, w) - (int)Math.Pow((-1), w)) / 3 - 1; List<cpolinom> table = NAFRLTable(p, ir, mul, pow, w); for (int i = x.Count - 1; i > -1; ) { List<BigInteger> max = FindLargest1(x, i, w); if (max[0] > 0) res = mul(res, table[(int)(bif.Abs(x[i]) / 2)]) % ir; else if (max[0] < 0) res = mul(res, inv(table[(int)(bif.Abs(x[i]) / 2)], ir)) % ir; for (int d = 0; d < max[1]; d++) for (int j = 0; j < table.Count; j++) table[j] = mul(table[j], table[j]) % ir; i = i - (int)max[1]; } return res; }
public static cpolinom wNAFSlideLR(cpolinom p, cpolinom ir, Multi mul, BigInteger n, int w, Inverse inv) { cpolinom res = new cpolinom("1", p.mod); List<BigInteger> x = bif.wNAF(n, w); int pow = 2 * ((int)Math.Pow(2, w) - (int)Math.Pow((-1), w)) / 3 - 1; List<cpolinom> table = NAFLRTable(p, ir, mul, pow, w); for (int i = 0; i < x.Count; ) { List<BigInteger> max = new List<BigInteger>(); if (x[i] == 0) { max.Add(0); max.Add(1); } else max = FindLargest2(x, i, w); for (int d = 0; d < max[1]; d++) res = mul(res, res) % ir; if (max[0] > 0) res = mul(res, table[(int)(bif.Abs(x[i]) / 2)]) % ir; else if (max[0] < 0) res = mul(res, inv(table[(int)(bif.Abs(x[i]) / 2)], ir)) % ir; i = i + (int)max[1]; } return res; }