public EncryptedShare(G1 u, byte[] v, G2 w, int id) { U = u; V = v; W = w; Id = id; }
/// <summary> /// Creates a debug string for spamming the display with too much information /// </summary> /// <returns>A formatted debug string</returns> public override string ToString() { return ("CurrentColumn: " + CurrentColumn.ToString() + "\n" + "CurrentRow:" + CurrentRow.ToString() + "\n" + "ApplicationCursorKeysMode:" + ApplicationCursorKeysMode.ToString() + "\n" + "Attribute:\n" + Attributes.ToString() + "\n" + "TabStops:" + string.Join(",", TabStops.Select(x => x.ToString()).ToList()) + "\n" + "WordWrap:" + WordWrap.ToString() + "\n" + "ReverseVideoMode:" + ReverseVideoMode.ToString() + "\n" + "OriginMode:" + OriginMode.ToString() + "\n" + "InsertMode:" + InsertMode.ToString() + "\n" + "ShowCursor:" + ShowCursor.ToString() + "\n" + "BlinkingCursor:" + BlinkingCursor.ToString() + "\n" + "CursorShape:" + CursorShape.ToString() + "\n" + "Utf8:" + Utf8.ToString() + "\n" + "CharacterSetMode:" + CharacterSetMode.ToString() + "\n" + "G0:" + G0.ToString() + "\n" + "G1:" + G1.ToString() + "\n" + "G2:" + G2.ToString() + "\n" + "G3:" + G3.ToString() + "\n" + "Vt300G1:" + Vt300G1.ToString() + "\n" + "Vt300G2:" + Vt300G2.ToString() + "\n" + "Vt300G3:" + Vt300G3.ToString() + "\n" + "Vt52AlternateKeypad: " + Vt52AlternateKeypad.ToString() + "\n" + "Vt52GraphicsMode: " + Vt52GraphicsMode.ToString() + "\n" + "AutomaticNewLine:" + AutomaticNewLine.ToString() + "\n" + "ConfiguredColumns:" + ConfiguredColumns.ToString() + "\n" + "National Character Replacement Mode:" + NationalCharacterReplacementMode.ToString() + "\n" + "Single shift character mode:" + SingleShiftSelectCharacterMode.ToString() + "\n" ); }
static void TestG1() { Console.WriteLine("TestG1"); G1 P = new G1(); P.Clear(); assert("P = 0", P.ToString() == "0"); assert("P.IsValid", P.IsValid()); assert("P.IsZero", P.IsZero()); P.HashAndMapTo("abc"); assert("P.IsValid", P.IsValid()); assert("!P.IsZero", !P.IsZero()); G1 Q = new G1(); Q = P.Clone(); assert("P == Q", Q.Equals(P)); G1.Neg(Q, P); G1.Add(Q, Q, P); assert("P = Q", Q.IsZero()); G1.Dbl(Q, P); G1 R = new G1(); G1.Add(R, P, P); assert("Q == R", Q.Equals(R)); Fr x = new Fr(); x.SetInt(3); G1.Add(R, R, P); G1.Mul(Q, P, x); assert("Q == R", Q.Equals(R)); }
public void TestG1() { var c = new G1 <BaseClass>(); I1 <BaseClass> i = c; Assert.AreEqual(1, i[0]); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$getItem"]); Assert.Null(c["getItem"]); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$" + baseClassAlias + "$getItem"]); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$setItem"]); Assert.Null(c["setItem"]); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$" + baseClassAlias + "$setItem"]); Assert.AreEqual(2, i.Prop1); Assert.AreEqual(i.Prop1, c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$Prop1"]); Assert.Null(c["Prop1"]); Assert.AreEqual(i.Prop1, c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$" + baseClassAlias + "$Prop1"]); Assert.Throws <NotImplementedException>(() => { i.e1 += () => { }; }); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$adde1"]); Assert.Null(c["adde1"]); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$" + baseClassAlias + "$adde1"]); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$removee1"]); Assert.Null(c["removee1"]); Assert.NotNull(c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$" + baseClassAlias + "$removee1"]); Assert.AreEqual(3, i.M1()); Assert.Null(c["M1"]); Assert.AreEqual(i.M1(), c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$M1"].As <Func <int> >()()); Assert.AreEqual(i.M1(), c["Bridge$ClientTest$Batch3$BridgeIssues$Bridge2638A$I1$1$" + baseClassAlias + "$M1"].As <Func <int> >()()); }
// Use this for initialization void Start() { G1 = Instantiate(g1, new Vector3(0, 0, 0), Quaternion.identity); G1.SetActive(false); G2 = Instantiate(g2, new Vector3(0, 0, 0), Quaternion.identity); G2.SetActive(false); }
static void TestETH_mapToG1() { var tbl = new[] { new { msg = "asdf", x = "a72df17570d0eb81260042edbea415ad49bdb94a1bc1ce9d1bf147d0d48268170764bb513a3b994d662e1faba137106", y = "122b77eca1ed58795b7cd456576362f4f7bd7a572a29334b4817898a42414d31e9c0267f2dc481a4daf8bcf4a460322", }, }; G1 P = new G1(); Fp x = new Fp(); Fp y = new Fp(); foreach (var v in tbl) { P.HashAndMapTo(v.msg); x.SetStr(v.x, 16); y.SetStr(v.y, 16); Normalize(ref P, P); Console.WriteLine("x={0}", P.x.GetStr(16)); Console.WriteLine("y={0}", P.y.GetStr(16)); assert("P.x", P.x.Equals(x)); assert("P.y", P.y.Equals(y)); } }
public static void TestArrayTypeAlias() { IFoo <IBar[]> foo = new G1 <IBar[]>(); Assert.AreEqual(1, foo.Foo(null)); IFoo <string> foo1 = new G2(); Assert.AreEqual(2, foo1.Foo(null)); var g3 = new G3(); IEquatable <IBar[]> ibar = g3; IEquatable <string[]> istr = g3; g3.tracker = 0; g3.Equals(new IBar[0]); Assert.AreEqual(1, g3.tracker); g3.tracker = 0; ibar.Equals(new IBar[0]); Assert.AreEqual(1, g3.tracker); g3.tracker = 0; istr.Equals(new string[0]); Assert.AreEqual(2, g3.tracker); }
public static Commitment FromBytes(IEnumerable <byte> buffer) { return(new Commitment(buffer.Batch(G1.ByteSize) .Select(x => x.ToArray()) .Select(b => G1.FromBytes(b.ToArray())) )); }
static void TestETH_mapToG1() { var tbl = new[] { new { msg = "asdf", dst = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_", x = "bc73d15443009a8ff2ddce864136d892274dd8365c60d0d2d44cc543387348e366a8f1e1401427e37743c29ed2c939a", y = "101e26428a1b78c05458cb1cc37d2d87876ad3437096d2827f376702d4451667fe1fa82e82795495d33d466133ed1862", }, }; G1 P = new G1(); Fp x = new Fp(); Fp y = new Fp(); foreach (var v in tbl) { P.HashAndMapTo(v.msg); x.SetStr(v.x, 16); y.SetStr(v.y, 16); Normalize(ref P, P); Console.WriteLine("x={0}", P.x.GetStr(16)); Console.WriteLine("y={0}", P.y.GetStr(16)); assert("P.x", P.x.Equals(x)); assert("P.y", P.y.Equals(y)); } }
static void TestPairing() { Console.WriteLine("TestG2"); G1 P = new G1(); P.setStr("1 -1 1"); G2 Q = new G2(); Q.HashAndMapTo("1"); Fr a = new Fr(); Fr b = new Fr(); a.SetStr("12345678912345673453"); b.SetStr("230498230982394243424"); G1 aP = new G1(); G2 bQ = new G2(); G1.Mul(aP, P, a); G2.Mul(bQ, Q, b); GT e1 = new GT(); GT e2 = new GT(); GT e3 = new GT(); Pairing(e1, P, Q); Pairing(e2, aP, Q); GT.Pow(e3, e1, a); assert("e2.Equals(e3)", e2.Equals(e3)); Pairing(e2, P, bQ); GT.Pow(e3, e1, b); assert("e2.Equals(e3)", e2.Equals(e3)); }
static void TestPairing() { Console.WriteLine("TestG2"); G1 P = new G1(); P.HashAndMapTo("123"); G2 Q = new G2(); Q.HashAndMapTo("1"); Fr a = new Fr(); Fr b = new Fr(); a.SetStr("12345678912345673453", 10); b.SetStr("230498230982394243424", 10); G1 aP = new G1(); G2 bQ = new G2(); aP.Mul(P, a); bQ.Mul(Q, b); GT e1 = new GT(); GT e2 = new GT(); GT e3 = new GT(); e1.Pairing(P, Q); e2.Pairing(aP, Q); e3.Pow(e1, a); assert("e2.Equals(e3)", e2.Equals(e3)); e2.Pairing(P, bQ); e3.Pow(e1, b); assert("e2.Equals(e3)", e2.Equals(e3)); }
static void TestG1() { Console.WriteLine("TestG1"); G1 P = new G1(); P.Clear(); assert("P.IsValid", P.IsValid()); assert("P.IsZero", P.IsZero()); P.HashAndMapTo("abc"); assert("P.IsValid", P.IsValid()); assert("!P.IsZero", !P.IsZero()); G1 Q = new G1(); Q = P; assert("P == Q", Q.Equals(P)); Q.Neg(P); Q.Add(Q, P); assert("P = Q", Q.IsZero()); Q.Dbl(P); G1 R = new G1(); R.Add(P, P); assert("Q == R", Q.Equals(R)); Fr x = new Fr(); x.SetInt(3); R.Add(R, P); Q.Mul(P, x); assert("Q == R", Q.Equals(R)); }
private void A1_Tick(object sender, EventArgs e) { PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5M^7ain ^5M^7enu\n\n^2-->^5Host Menu\nClient 1 Menu\nReset Menu\nAccount Menu\nTeleport Menu\nVision Menu\nCredit Menu\n\n\n^3Client 0 : ^2" + textBox1.Text + "\n^3Client 1 : ^2" + textBox2.Text + "^5"); if (Key_IsDown((uint)0) == "X") { HostMenuMain.Stop(); B1.Start(); } if (Key_IsDown((uint)0) == "R1") { HostMenuMain.Stop(); Client1.Start(); } if (Key_IsDown((uint)0) == "R3 + L3") { HostMenuMain.Stop(); B1.Stop(); B2.Stop(); B3.Stop(); B4.Stop(); B5.Stop(); Client1.Stop(); C1.Stop(); C2.Stop(); C3.Stop(); C4.Stop(); ResetMenu.Stop(); D1.Stop(); D2.Stop(); D3.Stop(); D4.Stop(); D5.Stop(); AccountMenu.Stop(); E1.Stop(); E2.Stop(); E3.Stop(); E4.Stop(); E5.Stop(); TeleportMenu.Stop(); F1.Stop(); F2.Stop(); F3.Stop(); F4.Stop(); VisionMenu.Stop(); G1.Stop(); G2.Stop(); G3.Stop(); G4.Stop(); G5.Stop(); G6.Stop(); OtherMenu.Stop(); H1.Stop(); PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed"); simpleButton2.Enabled = true; toolStripStatusLabel2.Text = "Not Started !"; toolStripStatusLabel2.ForeColor = Color.Red; simpleButton3.Enabled = false; } }
static void Main() { G1 <B, B> .Test1(new B()); G1 <B, B> .Test2(new B()); G1 <B, B> .Test3(null); }
public static G2 HashToG2(G1 g, IEnumerable <byte> w) { var join = g.ToBytes().Concat(w).ToArray(); var res = new G2(); res.SetHashOf(join); return(res); }
public void DeserializationG1Test() { var x = Fr.GetRandom(); var a = G1.Generator * x; var enc = a.ToBytes(); var b = G1.FromBytes(enc); Assert.True(a.Equals(b)); }
public override void RenderApp() { Render.To2D(); // VFX.VisualFX.Render(); G1.Draw(); VisualFX.Render(); }
private void Updatecolor() { //Metod za azuriranje boje Color color = Color.FromArgb(R1, G1, B1); colorshow.BackColor = color; Red.Text = R1.ToString(); Blue.Text = B1.ToString(); Green.Text = G1.ToString(); }
public static byte[] XorWithHash(G1 g, byte[] data) { var prng = new DigestRandomGenerator(new Sha3Digest()); prng.AddSeedMaterial(g.ToBytes()); var pseudoRandomBytes = new byte[data.Length]; prng.NextBytes(pseudoRandomBytes); return(Xor(pseudoRandomBytes, data)); }
public Fp12 MillerLoop() { // miller loop result equals "1" if at least one of the points is zero if (G1.IsZero() || G2.IsZero()) { return(Fp12.One); } return(PairingCheck.MillerLoop(G1, G2)); }
static void TestG1() { Console.WriteLine("TestG1"); G1 P = new G1(); assert("P.isZero", P.IsZero()); P.Clear(); assert("P.IsValid", P.IsValid()); assert("P.IsZero", P.IsZero()); P.HashAndMapTo("abc"); assert("P.IsValid", P.IsValid()); assert("!P.IsZero", !P.IsZero()); G1 Q = new G1(); Q = P; assert("P == Q", Q.Equals(P)); Q.Neg(P); Q.Add(Q, P); assert("P = Q", Q.IsZero()); Q.Dbl(P); G1 R = new G1(); R.Add(P, P); assert("Q == R", Q.Equals(R)); Fr x = new Fr(); x.SetInt(3); R.Add(R, P); Q.Mul(P, x); assert("Q == R", Q.Equals(R)); { byte[] buf = P.Serialize(); Q.Clear(); Q.Deserialize(buf); assert("P == Q", P.Equals(Q)); } { const int n = 5; G1[] xVec = new G1[n]; Fr[] yVec = new Fr[n]; P.Clear(); for (int i = 0; i < n; i++) { xVec[i].HashAndMapTo(i.ToString()); yVec[i].SetByCSPRNG(); Q.Mul(xVec[i], yVec[i]); P.Add(P, Q); } MulVec(ref Q, xVec, yVec); assert("mulVecG1", P.Equals(Q)); } G1 W = G1.Zero(); assert("W.IsZero", W.IsZero()); }
public async Task <string> Listar(string filmes = null) { try { Filmes f = !G1.Nada(filmes) ? JsonConvert.DeserializeObject <Filmes>(filmes, G1.CfJson()) : new Filmes();//convertemos o parâmetro para um formato que equivale a um objeto da classe cliente List <Filmes> lista = await Task.FromResult(new FilmesDal().Listar(f, GetConString())); return(JsonConvert.SerializeObject(lista)); } catch (Exception e) { return(JsonConvert.SerializeObject(GetException(e))); } }
public string Salvar(string filmes)//o parâmetro filmes, é uma string que virá na url do navegador, ou em uma requisição via ajax com javascript { try { Filmes f = JsonConvert.DeserializeObject <Filmes>(filmes, G1.CfJson()); //convertemos o parâmetro para um formato que equivale a um objeto da classe cliente new FilmesDal().Salvar(f, GetConString()); //salva os dados, e traz o Id que foi gerado dentro do objeto que foi passado como parâmetro, caso seja um novo cadastro //return JsonConvert.SerializeObject(f);//retorna o objeto, depois que foi salvo, com todos os dados return(JsonConvert.SerializeObject("Filme Cadastrado")); } catch (Exception e) { return(JsonConvert.SerializeObject(GetException(e))); } }
/// <summary> /// Evaluates the function. /// </summary> /// <param name="Arguments">Function arguments.</param> /// <param name="Variables">Variables collection.</param> /// <returns>Function result.</returns> public override IElement Evaluate(IElement[] Arguments, Variables Variables) { object x1 = Arguments[0].AssociatedObjectValue; object x2 = Arguments[1].AssociatedObjectValue; double p = Expression.ToDouble(Arguments[2].AssociatedObjectValue); SKImage Img1, Img2; SKColor c1, c2; if (x1 is SKColor C1) { c1 = C1; Img1 = null; } else if (x1 is Graph G1) { Img1 = G1.CreateBitmap(Variables); c1 = SKColor.Empty; } else if (x1 is SKImage I1) { Img1 = I1; c1 = SKColor.Empty; } else { Img1 = null; c1 = Graph.ToColor(x1); } if (x2 is SKColor C2) { c2 = C2; Img2 = null; } else if (x2 is Graph G2) { Img2 = G2.CreateBitmap(Variables); c2 = SKColor.Empty; } else if (x2 is SKImage I2) { Img2 = I2; c2 = SKColor.Empty; } else { Img2 = null; c2 = Graph.ToColor(x2); } if (Img1 is null && Img2 is null) { return(new ObjectValue(BlendColors(c1, c2, p))); }
public async Task <string> Listar(string cliente = null) { try { Cliente c = !G1.Nada(cliente) ? JsonConvert.DeserializeObject <Cliente>(cliente, G1.CfJson()): new Cliente();//convertemos o parâmetro para um formato que equivale a um objeto da classe cliente List <Cliente> lista = await Task.FromResult(new ClienteDal().Listar(c, GetConString())); return(JsonConvert.SerializeObject(lista)); } catch (Exception e) { return(JsonConvert.SerializeObject(GetException(e))); } }
public async Task <string> Listar(string itenslocacao = null) { try { // ItensLocacao i = G1.Nada(itenslocacao) ? JsonConvert.DeserializeObject<ItensLocacao>(itenslocacao, G1.CfJson()) : new ItensLocacao();//convertemos o parâmetro para um formato que equivale a um objeto da classe cliente ItensLocacao i = G1.Nada(itenslocacao) ? JsonConvert.DeserializeObject <ItensLocacao>(itenslocacao, G1.CfJson()) : new ItensLocacao();//convertemos o parâmetro para um formato que equivale a um objeto da classe cliente List <ItensLocacao> lista = await Task.FromResult(new ItensLocacaoDal().Listar(i, GetConString())); return(JsonConvert.SerializeObject(lista)); } catch (Exception e) { return(JsonConvert.SerializeObject(GetException(e))); } }
public void SerializationRoundTrip() { var x = G1.Generator * Fr.GetRandom(); Assert.IsTrue(x.IsValid()); var serialized = x.ToBytes(); Assert.AreEqual(48, serialized.Length); var restored = G1.FromBytes(serialized); Assert.AreEqual(x, restored); }
public static void Main(string[] args) { G obj; obj = new G1(); obj.gfg1(); Console.WriteLine(); MyClass obj1 = new MyClass(); obj1.show(); }
public string Devolver(string locacao)//o parâmetro cliente, é uma string que virá na url do navegador, ou em uma requisição via ajax com javascript { try { Locacao l = JsonConvert.DeserializeObject <Locacao>(locacao, G1.CfJson());//convertemos o parâmetro para um formato que equivale a um objeto da classe cliente bool jaExiste = new LocacaoDal().ExisteLocacao(l, GetConString()); if (jaExiste == false) { throw new Exception("Esta Locação não está pendente!!!"); } bool emAtraso = new LocacaoDal().EmAtraso(l, GetConString()); new LocacaoDal().Devolver(l, GetConString()); return(JsonConvert.SerializeObject(new { retorno = emAtraso ? "Devolvido com Atraso" : "Devolvido em Dia" })); } catch (Exception e) { return(JsonConvert.SerializeObject(GetException(e))); } }
public string Salvar(string locacao)//o parâmetro cliente, é uma string que virá na url do navegador, ou em uma requisição via ajax com javascript { try { Locacao l = JsonConvert.DeserializeObject <Locacao>(locacao, G1.CfJson());//convertemos o parâmetro para um formato que equivale a um objeto da classe cliente bool jaExiste = new LocacaoDal().VerLocPendente(l, GetConString()); if (jaExiste) { throw new Exception("Esse Cliente tem Locações Pendentes!!!"); } new LocacaoDal().Salvar(l, GetConString());//salva os dados, e traz o Id que foi gerado dentro do objeto que foi passado como parâmetro, caso seja um novo cadastro // return JsonConvert.SerializeObject(l);//retorna o objeto, depois que foi salvo, com todos os dados return(JsonConvert.SerializeObject("Locação Inserida!")); } catch (Exception e) { return(JsonConvert.SerializeObject(GetException(e))); } }