Example #1
0
 private void button_CaculateTextHash_Click(object sender, RoutedEventArgs e)
 {
     getOpt();
     re = new result()
     {
         size   = -1,
         date   = DateTime.MinValue,
         md5    = null,
         sha1   = null,
         sha256 = null,
         sha384 = null,
         sha512 = null,
         crc32  = null,
         crc64  = null
     };
     if (!string.IsNullOrEmpty(textBox_InputText.Text))
     {
         byte[] bts = System.Text.Encoding.Default.GetBytes(textBox_InputText.Text);
         re = CommenFunction.GetResult(bts, opt);
     }
     textBox_OutputResult.Text += "\nText Hash is : \n";
     re.size = -1;
     re.date = DateTime.MinValue;
     ShowResult(re, opt);
 }
Example #2
0
 private void button_CaculateFileHash_Click(object sender, RoutedEventArgs e)
 {
     getOpt();
     re = new result()
     {
         size   = -1,
         date   = DateTime.MinValue,
         md5    = null,
         sha1   = null,
         sha256 = null,
         sha384 = null,
         sha512 = null,
         crc32  = null,
         crc64  = null
     };
     if (!string.IsNullOrEmpty(textBox_FileName.Text) && System.IO.File.Exists(textBox_FileName.Text))
     {
         byte[] bts = System.IO.File.ReadAllBytes(textBox_FileName.Text);
         re = CommenFunction.GetResult(bts, opt);
     }
     if (opt.size && !string.IsNullOrEmpty(textBox_FileName.Text))
     {
         re.size = CommenFunction.GetFileSize(textBox_FileName.Text);
     }
     if (opt.date && !string.IsNullOrEmpty(textBox_FileName.Text))
     {
         re.date = CommenFunction.GetFileCreationTime(textBox_FileName.Text);
     }
     textBox_OutputResult.Text += "\nFile Name: " + textBox_FileName.Text + "\n";
     ShowResult(re, opt);
 }