diff --git a/GhettoCryptCLI/GhettoCryptCLI.vcxproj b/GhettoCryptCLI/GhettoCryptCLI.vcxproj
index a7fc35a..a7f60d6 100644
--- a/GhettoCryptCLI/GhettoCryptCLI.vcxproj
+++ b/GhettoCryptCLI/GhettoCryptCLI.vcxproj
@@ -151,6 +151,7 @@
+
diff --git a/GhettoCryptCLI/GhettoCryptCLI.vcxproj.filters b/GhettoCryptCLI/GhettoCryptCLI.vcxproj.filters
index 786c2ed..ec80bbc 100644
--- a/GhettoCryptCLI/GhettoCryptCLI.vcxproj.filters
+++ b/GhettoCryptCLI/GhettoCryptCLI.vcxproj.filters
@@ -32,5 +32,8 @@
Headerdateien
+
+ Headerdateien
+
\ No newline at end of file
diff --git a/GhettoCryptCLI/gecrypt b/GhettoCryptCLI/gecrypt
index 3e670d5..8739d6b 100644
Binary files a/GhettoCryptCLI/gecrypt and b/GhettoCryptCLI/gecrypt differ
diff --git a/GhettoCryptCLI/main.cpp b/GhettoCryptCLI/main.cpp
index b3fd5d4..1af854c 100644
--- a/GhettoCryptCLI/main.cpp
+++ b/GhettoCryptCLI/main.cpp
@@ -8,8 +8,51 @@
#include "../GhettoCrypt/Flexblock.h"
#include "../GhettoCrypt/Block.h"
+#if defined _WIN32 || defined _WIN64
+#include
+#elif defined __GNUG__
+#include
+#include
+#endif
+
using namespace GhettoCipher;
+//! Will prompt a user password from stdin, hiding the input
+std::string PasswordPrompt()
+{
+ // Disable stdin-echo
+ #if defined _WIN32 || defined _WIN64
+ HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
+ DWORD mode = 0;
+ GetConsoleMode(hStdin, &mode);
+ SetConsoleMode(hStdin, mode & (~ENABLE_ECHO_INPUT));
+
+ #elif defined __GNUG__
+ termios oldt;
+ tcgetattr(STDIN_FILENO, &oldt);
+ termios newt = oldt;
+ newt.c_lflag &= ~ECHO;
+ tcsetattr(STDIN_FILENO, TCSANOW, &newt);
+
+ #endif
+
+ // Prompt stdin
+ std::string key;
+ std::cin >> key;
+
+ // Restore previous config
+ #if defined _WIN32 || defined _WIN64
+ SetConsoleMode(hStdin, mode);
+
+ #elif defined __GNUG__
+ tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
+
+ #endif
+
+ // Return input
+ return key;
+}
+
Block GetEncryptionKey()
{
// Easy-case: key supplied as param
@@ -18,11 +61,7 @@ Block GetEncryptionKey()
// Case: Ask for key
else if (CommandlineInterface::Get().HasParam("--keyask"))
- {
- std::string key;
- std::cin >> key;
- return StringToBitblock(key);
- }
+ return StringToBitblock(PasswordPrompt());
// Case: Read key from file
else if (CommandlineInterface::Get().HasParam("--keyfile"))