Esempio n. 1
0
        static void Main(string[] args)
        {
            _PrintHeader();

            //we should have 2 params, no more, no less
            if (args.Count() != 2)
            {
                Console.WriteLine("Invalid command line parameters! Try again!");
                return;
            }

            //we assume the first param is the path we are working with
            // so we should see if it acually exists
            if (!Directory.Exists(args[0]) && !File.Exists(args[0]))
            {
                Console.WriteLine(string.Format("Path does not exist: {0}", args[0]));
                return;
            }

            //figure out the algo
            HashAlgorithm hash;

            switch (args[1])
            {
            case "/md5":
                hash = HashAlgorithm.MD5;
                break;

            case "/sha1":
                hash = HashAlgorithm.SHA1;
                break;

            case "/sha256":
                hash = HashAlgorithm.SHA256;
                break;

            case "/blake2b":
                hash = HashAlgorithm.BLAKE2b;
                break;

            default:
                Console.WriteLine(string.Format("Invalid Hash Selection: {0}", args[1]));
                return;

                break;
            }

            //let the user know what we're doing, in case they keep the log
            Console.WriteLine(string.Format("Working Path: {0}", args[0]));
            Console.WriteLine(string.Format("Using Hash: {0}", hash));
            Console.WriteLine();

            var prc = new HashProcessor(hash, args[0]);

            prc.Run();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            _PrintHeader();

              //we should have 2 params, no more, no less
              if (args.Count() != 2)
              {
            Console.WriteLine("Invalid command line parameters! Try again!");
            return;
              }

              //we assume the first param is the path we are working with
              // so we should see if it acually exists
              if (!Directory.Exists(args[0]) && !File.Exists(args[0]))
              {
            Console.WriteLine(string.Format("Path does not exist: {0}", args[0]));
            return;
              }

              //figure out the algo
              HashAlgorithm hash;
              switch(args[1])
              {
            case "/md5":
              hash = HashAlgorithm.MD5;
              break;
            case "/sha1":
              hash = HashAlgorithm.SHA1;
              break;
            case "/sha256":
              hash = HashAlgorithm.SHA256;
              break;
            case "/blake2b":
              hash = HashAlgorithm.BLAKE2b;
              break;
            default:
              Console.WriteLine(string.Format("Invalid Hash Selection: {0}", args[1]));
              return;
              break;
              }

              //let the user know what we're doing, in case they keep the log
              Console.WriteLine(string.Format("Working Path: {0}", args[0]));
              Console.WriteLine(string.Format("Using Hash: {0}", hash));
              Console.WriteLine();

              var prc = new HashProcessor(hash, args[0]);
              prc.Run();
        }