private void Crc32Menu_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog { Filter = "All Files|*.*" }; if (dialog.ShowDialog() == DialogResult.OK) { var data = File.ReadAllBytes(dialog.FileName); var hash = Crc32.CalculateCrc(data); var bytes = BitConverter.GetBytes(hash); var hashString = BitConverter.ToString(bytes); CopyMessageBox.Show("CRC32:", hash.ToString(), "Calculated CRC32"); } }
private void Md5Menu_Click(object sender, EventArgs e) { var dialog = new OpenFileDialog { Filter = "All Files|*.*" }; if (dialog.ShowDialog() == DialogResult.OK) { var data = File.ReadAllBytes(dialog.FileName); byte[] hash; using (var md5 = MD5.Create()) { hash = md5.ComputeHash(data); } var hashString = BitConverter.ToString(hash); CopyMessageBox.Show("MD5:", hashString, "Calculated MD5"); } }