Skip to content

Commit

Permalink
Comments and debug functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Gut committed May 1, 2017
1 parent 502a6a7 commit 372a28d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crypt/Crypt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public int GetSize()
}
}

/// <summary>
/// provides File encryption and decryption capabilities
/// </summary>
public class Crypt
{
[Flags]
Expand Down Expand Up @@ -134,6 +137,12 @@ public enum CryptResult : int
/// </summary>
public const string HEADER = "ACRYPT";

#if DEBUG
/// <summary>
/// Creates the Hash of a stream.
/// </summary>
/// <param name="S">Input stream</param>
/// <returns>SHA256</returns>
public static byte[] Hash(Stream S)
{
using (var Hasher = (SHA256)HashAlgorithm.Create(HASHALG))
Expand All @@ -142,6 +151,7 @@ public static byte[] Hash(Stream S)
return Hash;
}
}
#endif

/// <summary>
/// Encrypts a file
Expand Down
8 changes: 8 additions & 0 deletions crypt/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ static void Main(string[] args)
#endif
}

/// <summary>
/// Reads a password from STDIN and masks it.
/// It's incompatible with stream redirection.
/// </summary>
/// <returns>User supplied password</returns>
private static string ReadPassword()
{
#if DEBUG
Expand Down Expand Up @@ -186,6 +191,9 @@ private static string ReadPassword()
#endif
}

/// <summary>
/// Prints the help
/// </summary>
private static void ShowHelp()
{
Console.Error.WriteLine(@"crypt {/e|/d} <input>
Expand Down

0 comments on commit 372a28d

Please sign in to comment.