From 372a28dd4a1aff295638700513030bbf5dca3472 Mon Sep 17 00:00:00 2001 From: Kevin Gut Date: Mon, 1 May 2017 18:13:39 +0200 Subject: [PATCH] Comments and debug functions --- crypt/Crypt.cs | 10 ++++++++++ crypt/Program.cs | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/crypt/Crypt.cs b/crypt/Crypt.cs index 675f8b2..854c57e 100644 --- a/crypt/Crypt.cs +++ b/crypt/Crypt.cs @@ -56,6 +56,9 @@ public int GetSize() } } + /// + /// provides File encryption and decryption capabilities + /// public class Crypt { [Flags] @@ -134,6 +137,12 @@ public enum CryptResult : int /// public const string HEADER = "ACRYPT"; +#if DEBUG + /// + /// Creates the Hash of a stream. + /// + /// Input stream + /// SHA256 public static byte[] Hash(Stream S) { using (var Hasher = (SHA256)HashAlgorithm.Create(HASHALG)) @@ -142,6 +151,7 @@ public static byte[] Hash(Stream S) return Hash; } } +#endif /// /// Encrypts a file diff --git a/crypt/Program.cs b/crypt/Program.cs index 05c3517..8ebbad9 100644 --- a/crypt/Program.cs +++ b/crypt/Program.cs @@ -143,6 +143,11 @@ static void Main(string[] args) #endif } + /// + /// Reads a password from STDIN and masks it. + /// It's incompatible with stream redirection. + /// + /// User supplied password private static string ReadPassword() { #if DEBUG @@ -186,6 +191,9 @@ private static string ReadPassword() #endif } + /// + /// Prints the help + /// private static void ShowHelp() { Console.Error.WriteLine(@"crypt {/e|/d}