Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Security.Cryptography;
- using System.Text;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input;
- if (args.Length == 0)
- {
- input = Console.ReadLine();
- }
- else
- {
- input = args[0];
- }
- MD5 md5 = MD5.Create();
- byte[] hash = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
- string output = Convert.ToBase64String(hash);
- string writePath = "hash.txt";
- try
- {
- using (StreamWriter sw = new StreamWriter(writePath, false, Encoding.Default))
- {
- sw.WriteLine(output);
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment