43 lines
1.0 KiB
C#
43 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mk0.Software.MD5Generator
|
|
{
|
|
public partial class Main : Form
|
|
{
|
|
public Main()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void ButtonSelectFile_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult res = openFileDialog.ShowDialog();
|
|
if(res == DialogResult.OK)
|
|
{
|
|
GenerateMD5(openFileDialog.FileName);
|
|
}
|
|
}
|
|
|
|
private void GenerateMD5(string filename)
|
|
{
|
|
using (var md5 = MD5.Create())
|
|
{
|
|
using (var stream = File.OpenRead(filename))
|
|
{
|
|
textBoxMD5.Text = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", string.Empty);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|