VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-04-24 22:56:42 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-04-26 00:05:22 +0200
commit9ccb8a97afe66516b02da88b0997cc0d944a1010 (patch)
tree6fc7da54faf4791370a29b130aee6b1037a752d4
parentbf8e07966be201ad47f112c6a8e93a897bfc6c80 (diff)
downloadVeraCrypt-9ccb8a97afe66516b02da88b0997cc0d944a1010.tar.gz
VeraCrypt-9ccb8a97afe66516b02da88b0997cc0d944a1010.zip
Linux: in command line, support hash algorithm names without '-' as on Windows ("sha256", "sha512", "ripemd160")
-rw-r--r--src/Main/CommandLineInterface.cpp12
-rw-r--r--src/Volume/Hash.h5
2 files changed, 14 insertions, 3 deletions
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 82a99e7f..541f66d0 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -307,7 +307,9 @@ namespace VeraCrypt
foreach (shared_ptr <Hash> hash, Hash::GetAvailableAlgorithms())
{
- if (wxString (hash->GetName()).IsSameAs (str, false))
+ wxString hashName (hash->GetName());
+ wxString hashAltName (hash->GetAltName());
+ if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false))
ArgHash = hash;
}
@@ -321,7 +323,9 @@ namespace VeraCrypt
foreach (shared_ptr <Hash> hash, Hash::GetAvailableAlgorithms())
{
- if (wxString (hash->GetName()).IsSameAs (str, false))
+ wxString hashName (hash->GetName());
+ wxString hashAltName (hash->GetAltName());
+ if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false))
ArgCurrentHash = hash;
}
@@ -405,7 +409,9 @@ namespace VeraCrypt
bool bHashFound = false;
foreach (shared_ptr <Hash> hash, Hash::GetAvailableAlgorithms())
{
- if (wxString (hash->GetName()).IsSameAs (str, false))
+ wxString hashName (hash->GetName());
+ wxString hashAltName (hash->GetAltName());
+ if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false))
{
bHashFound = true;
ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash, ArgTrueCryptMode);
diff --git a/src/Volume/Hash.h b/src/Volume/Hash.h
index 3df9f5b7..db9ad679 100644
--- a/src/Volume/Hash.h
+++ b/src/Volume/Hash.h
@@ -27,6 +27,7 @@ namespace VeraCrypt
virtual size_t GetBlockSize () const = 0;
virtual size_t GetDigestSize () const = 0;
virtual wstring GetName () const = 0;
+ virtual wstring GetAltName () const = 0;
virtual shared_ptr <Hash> GetNew () const = 0;
virtual void Init () = 0;
bool IsDeprecated () const { return Deprecated; }
@@ -54,6 +55,7 @@ namespace VeraCrypt
virtual size_t GetBlockSize () const { return 64; }
virtual size_t GetDigestSize () const { return 160 / 8; }
virtual wstring GetName () const { return L"RIPEMD-160"; }
+ virtual wstring GetAltName () const { return L"RIPEMD160"; }
virtual shared_ptr <Hash> GetNew () const { return shared_ptr <Hash> (new Ripemd160); }
virtual void Init ();
virtual void ProcessData (const ConstBufferPtr &data);
@@ -76,6 +78,7 @@ namespace VeraCrypt
virtual size_t GetBlockSize () const { return 64; }
virtual size_t GetDigestSize () const { return 256 / 8; }
virtual wstring GetName () const { return L"SHA-256"; }
+ virtual wstring GetAltName () const { return L"SHA256"; }
virtual shared_ptr <Hash> GetNew () const { return shared_ptr <Hash> (new Sha256); }
virtual void Init ();
virtual void ProcessData (const ConstBufferPtr &data);
@@ -98,6 +101,7 @@ namespace VeraCrypt
virtual size_t GetBlockSize () const { return 128; }
virtual size_t GetDigestSize () const { return 512 / 8; }
virtual wstring GetName () const { return L"SHA-512"; }
+ virtual wstring GetAltName () const { return L"SHA512"; }
virtual shared_ptr <Hash> GetNew () const { return shared_ptr <Hash> (new Sha512); }
virtual void Init ();
virtual void ProcessData (const ConstBufferPtr &data);
@@ -120,6 +124,7 @@ namespace VeraCrypt
virtual size_t GetBlockSize () const { return 64; }
virtual size_t GetDigestSize () const { return 512 / 8; }
virtual wstring GetName () const { return L"Whirlpool"; }
+ virtual wstring GetAltName () const { return L"Whirlpool"; }
virtual shared_ptr <Hash> GetNew () const { return shared_ptr <Hash> (new Whirlpool); }
virtual void Init ();
virtual void ProcessData (const ConstBufferPtr &data);