ptitza_in_da_ruboard
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Код: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Aom { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void label4_Click(object sender, EventArgs e) { } private void textBox4_TextChanged(object sender, EventArgs e) { int i; Single j; byte[] b = new byte[] { 0x12, 0x34, 0x56, 0x78};; byte[] k0 = new byte[] { 0x12, 0x34, 0x56, 0x78}; byte[] k1 = new byte[] { 0x09, 0xAB, 0xCD, 0xEF}; byte[] k2 = new byte[] { 0x0B, 0xAD, 0xF0, 0x0D}; byte[] k3 = new byte[] { 0xDE, 0xAD, 0xBE, 0xEF}; byte swp=1; j = System.Convert.ToSingle("0"+textBox1.Text); b = BitConverter.GetBytes(j); for(i=0;i<4;i++) b[i] = System.Convert.ToByte(b[i] ^ k0[3-i]); textBox5.Text=BitConverter.ToUInt32(b,0).ToString(); b = BitConverter.GetBytes(System.Convert.ToSingle("0"+textBox2.Text)); for(i=0;i<4;i++) b[i] = System.Convert.ToByte(b[i] ^ k1[3-i]); textBox6.Text=BitConverter.ToUInt32(b,0).ToString(); b = BitConverter.GetBytes(System.Convert.ToSingle("0" + textBox3.Text)); for(i=0;i<4;i++) b[i] = System.Convert.ToByte(b[i] ^ k2[3-i]); textBox7.Text=BitConverter.ToUInt32(b,0).ToString(); b = BitConverter.GetBytes(System.Convert.ToSingle("0" + textBox4.Text)); for(i=0;i<4;i++) b[i] = System.Convert.ToByte(b[i] ^ k3[3-i]); textBox8.Text=BitConverter.ToUInt32(b,0).ToString(); //ToHexString(b)); // str = BitConverter.ToString(bytes); /* byte[] vals = { 0x01, 0xAA, 0xB1, 0xDC, 0x10, 0xDD }; string str = BitConverter.ToString(vals); Console.WriteLine(str); str = BitConverter.ToString(vals).Replace("-", ""); Console.WriteLine(str); */ /*Output: 01-AA-B1-DC-10-DD 01AAB1DC10DD * */ } } } | |