/* recursive inc */ public void rinc(int vp, FF y, int yp, int n) { for (int i = 0; i < n; i++) { v[vp + i].add(y.v[yp + i]); } }
void Handle(Input.DelTrgr Action) { var r = Root as MasterPage; var p = this.Parent as FFsRpr; if (p.DlgRec.Ad != "Sil") { Msj = "Silmek için Not alanına Sil yazın."; Action.Cancelled = true; return; } Msj = FF.DeleteRec((ulong)Id, (ulong)r.CUId); if (!string.IsNullOrEmpty(Msj)) { Action.Cancelled = true; return; } p.Data = null; Session.RunTaskForAll((s, sId) => { var cp = (s.Store[nameof(MasterPage)] as MasterPage).CurrentPage; if (cp is FFsPage) { (s.Store[nameof(MasterPage)] as MasterPage).CurrentPage.Data = null; s.CalculatePatchAndPushOnWebSocket(); } }); Opened = false; }
public void Compsose_Test1() { var Z1 = FF.Compose(GG); var a1 = Z1(3.14); Assert.AreEqual("3", a1); }
/* this =this^e mod p using side-channel resistant Montgomery Ladder, for short e */ public void skpow(BIG e, FF p) { int i, b, n = p.length; FF R0 = new FF(n); FF R1 = new FF(n); FF ND = p.invmod2m(); mod(p); R0.one(); R1.copy(this); R0.nres(p); R1.nres(p); for (i = 8 * ROM.MODBYTES - 1; i >= 0; i--) { b = e.bit(i); copy(R0); modmul(R1, p, ND); cswap(R0, R1, b); R0.modsqr(p, ND); R1.copy(this); cswap(R0, R1, b); } copy(R0); redc(p, ND); }
void Handle(Input.InsTrgr Action) { //TrhX girilmediginde 00:00:00 geliyor. DateTime'a convert edince Gunun tarihi geliyor! //When only the time is present, the date portion uses the current date. //When only the date is present, the time portion is midnight. //When the year isn't specified in a date, the current year is used. //When the day of the month isn't specified, the first of the month is used. //How to set only time part of a DateTime variable //var newDate = oldDate.Date + new TimeSpan(11, 30, 55); var r = Root as MasterPage; var p = this.Parent as FFsRpr; Msj = FF.InsertRec(p.PPId, HHId, TTId, $"{TrhX} {ZmnX}", Ad, TutTur, Tut, r.CUId); if (!string.IsNullOrEmpty(Msj)) { Action.Cancelled = true; return; } Id = 0; Opened = false; p.Data = null; Session.RunTaskForAll((s, sId) => { var cp = (s.Store[nameof(MasterPage)] as MasterPage).CurrentPage; if (cp is FFsPage) { (s.Store[nameof(MasterPage)] as MasterPage).CurrentPage.Data = null; s.CalculatePatchAndPushOnWebSocket(); } }); }
/* copy from FF b */ public void copy(FF b) { for (int i = 0; i < length; i++) { v[i].copy(b.v[i]); } }
/* quick and dirty check for common factor with n */ public bool cfactor(int s) { int r, n = length; int g; FF x = new FF(n); FF y = new FF(n); y.set(s); x.copy(this); x.norm(); do { x.sub(y); x.norm(); while (!x.iszilch() && x.parity() == 0) { x.shr(); } } while (comp(x, y) > 0); g = (int)x.v[0].get(0); r = igcd(s, g); if (r > 1) { return(true); } return(false); }
void Handle(Input.UpdTrgr Action) { if (Id != 0) { var r = Root as MasterPage; Msj = FF.UpdateRec((ulong)Id, (ulong)HHId, (ulong)TTId, $"{TrhX} {ZmnX}", Ad, TutTur, Tut, (ulong)r.CUId); if (!string.IsNullOrEmpty(Msj)) { Action.Cancelled = true; return; } var p = this.Parent as FFsRpr; p.RefreshToplam(); Id = 0; Session.RunTaskForAll((s, id) => { s.CalculatePatchAndPushOnWebSocket(); }); } Opened = false; }
/* RSA decryption with the private key */ public static void DECRYPT(rsa_private_key PRIV, sbyte[] G, sbyte[] F) { int n = PRIV.p.getlen(); FF g = new FF(2 * n); FF.fromBytes(g, G); FF jp = g.dmod(PRIV.p); FF jq = g.dmod(PRIV.q); jp.skpow(PRIV.dp, PRIV.p); jq.skpow(PRIV.dq, PRIV.q); g.zero(); g.dscopy(jp); jp.mod(PRIV.q); if (FF.comp(jp, jq) > 0) { jq.add(PRIV.q); } jq.sub(jp); jq.norm(); FF t = FF.mul(PRIV.c, jq); jq = t.dmod(PRIV.q); t = FF.mul(jq, PRIV.p); g.add(t); g.norm(); g.toBytes(F); }
public void FindsInhertitedProperties() { var model = new InhertitingClass(); var propertyVmsUsingReflection = FF.GetPropertyVmsUsingReflection(model, typeof(object)).ToList(); Assert.IsNotNull(propertyVmsUsingReflection.SingleOrDefault(_ => _.Name == nameof(BaseClass.BaseClassStringProperty)), $"Inherited property '{nameof(BaseClass.BaseClassStringProperty)}' missing."); }
/* Set r=this mod b */ /* this is of length - 2*n */ /* r,b is of length - n */ public FF dmod(FF b) { int k, n = b.length; FF m = new FF(2 * n); FF x = new FF(2 * n); FF r = new FF(n); x.copy(this); x.norm(); m.dsucopy(b); k = 256 * n; while (k > 0) { m.shr(); if (comp(x, m) >= 0) { x.sub(m); x.norm(); } k--; } r.copy(x); r.mod(b); return(r); }
private void button3_Click(object sender, EventArgs e) { OpenFileDialog fdlg = new OpenFileDialog(); fdlg.Title = "Open Map File"; fdlg.Filter = "Text Files|*.doc;*.docx;*.txt;*.text"; if (fdlg.ShowDialog() == DialogResult.OK) { textBox5.Text = fdlg.FileName; } GetinfoFromMapFile(); textBox11.Clear(); textBox6.Clear(); textBox10.Clear(); count++; Fname = null; Fname = "Output"; Fname += count; Fname += ".txt"; FileStream FF; if (File.Exists(Fname)) { FF = new FileStream(Fname, FileMode.Truncate); } else { FF = new FileStream(Fname, FileMode.Create); } FF.Close(); }
/* Set b=b mod c */ public void mod(FF c) { int k = 0; norm(); if (comp(this, c) < 0) { return; } do { c.shl(); k++; } while (comp(this, c) >= 0); while (k > 0) { c.shr(); if (comp(this, c) >= 0) { sub(c); norm(); } k--; } }
public static void fromBytes(FF x, sbyte[] b) { for (int i = 0; i < x.length; i++) { x.v[i] = BIG.frombytearray(b, (x.length - i - 1) * ROM.MODBYTES); } }
/* reverse sub */ public void revsub(FF b) { for (int i = 0; i < length; i++) { v[i].rsub(b.v[i]); } }
/* simple add */ public void add(FF b) { for (int i = 0; i < length; i++) { v[i].add(b.v[i]); } }
/* recursive dec */ public void rdec(int vp, FF y, int yp, int n) { for (int i = 0; i < n; i++) { v[vp + i].sub(y.v[yp + i]); } }
/* x=y */ public void dscopy(FF b) { for (int i = 0; i < b.length; i++) { v[i].copy(b.v[i]); v[b.length + i].zero(); } }
/* in-place swapping using xor - side channel resistant - lengths must be the same */ private static void cswap(FF a, FF b, int d) { for (int i = 0; i < a.length; i++) { // BIG.cswap(a.v[i],b.v[i],d); a.v[i].cswap(b.v[i], d); } }
/* recursive sub */ public void rsub(int vp, FF x, int xp, FF y, int yp, int n) { for (int i = 0; i < n; i++) { v[vp + i].copy(x.v[xp + i]); v[vp + i].sub(y.v[yp + i]); } }
/* nresidue mod m */ public void nres(FF m) { int n = m.length; FF d = new FF(2 * n); d.dsucopy(this); copy(d.dmod(m)); }
public rsa_private_key(int n) { p = new FF(n); q = new FF(n); dp = new FF(n); dq = new FF(n); c = new FF(n); }
// Start is called before the first frame update void Start() { emotion.SetActive(false); transform.localPosition = initial; counter = 0; fF = this; facing = true; }
/* z=x*y. Assumes x and y are of same length. */ public static FF mul(FF x, FF y) { int n = x.length; FF z = new FF(2 * n); FF t = new FF(2 * n); z.karmul(0, x, 0, y, 0, t, 0, n); return(z); }
/* return low part of product this*y */ public void lmul(FF y) { int n = length; FF t = new FF(2 * n); FF x = new FF(n); x.copy(this); karmul_lower(0, x, 0, y, 0, t, 0, n); }
/* z=x^2 */ public static FF sqr(FF x) { int n = x.length; FF z = new FF(2 * n); FF t = new FF(2 * n); z.karsqr(0, x, 0, t, 0, n); return(z); }
/* RSA encryption with the public key */ public static void ENCRYPT(rsa_public_key PUB, sbyte[] F, sbyte[] G) { int n = PUB.n.getlen(); FF f = new FF(n); FF.fromBytes(f, F); f.power(PUB.e, PUB.n); f.toBytes(G); }
public static async Task MainAsync(string[] args) { var someObject = new { SomeProperty = "SomeValue" }; var properties = FF.PropertiesFor(someObject); var s = await properties.RenderAsync(); Console.WriteLine(s); Console.ReadLine(); }
public void redc(FF m, FF ND) { int n = m.length; FF d = new FF(2 * n); mod(m); d.dscopy(this); copy(d.reduce(m, ND)); mod(m); }
/* generate random x */ public void randomnum(FF p, RAND rng) { int n = length; FF d = new FF(2 * n); for (int i = 0; i < 2 * n; i++) { d.v[i].copy(BIG.random(rng)); } copy(d.dmod(p)); }
public PITCH_FF(PITCH pitch = PITCH.DEFAULT, FF family = FF.DONTCARE) { _value = (int)pitch | (int)family; }