mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 12:07:07 -06:00
Add SHA3 hashing
- added these variants: SHA3-256, SHA3-384, SHA3-512 - reordered also the hashing id's - added some notes about them in DOC/Hashes.txt Signed-off-by: Tino Reichardt <milky-7zip@mcmilk.de>
This commit is contained in:
@@ -807,18 +807,10 @@ static const char *SkipWhite(const char *s)
|
||||
|
||||
static const char * const k_CsumMethodNames[] =
|
||||
{
|
||||
"sha256"
|
||||
, "sha224"
|
||||
// , "sha512/224"
|
||||
// , "sha512/256"
|
||||
, "sha512"
|
||||
, "sha384"
|
||||
, "sha1"
|
||||
, "md5"
|
||||
, "blake2b"
|
||||
, "crc64"
|
||||
, "crc32"
|
||||
, "cksum"
|
||||
"sha3-512", "sha3-384", "sha3-256",
|
||||
"sha512", "sha384", "sha256", "sha224",
|
||||
"sha1", "md5", "blake2b",
|
||||
"crc32", "crc64" , "cksum"
|
||||
};
|
||||
|
||||
static UString GetMethod_from_FileName(const UString &name)
|
||||
@@ -1421,7 +1413,8 @@ static bool CheckDigests(const Byte *a, const Byte *b, size_t size)
|
||||
static void AddDefaultMethod(UStringVector &methods, unsigned size)
|
||||
{
|
||||
const char *m = NULL;
|
||||
if (size == 32) m = "sha256";
|
||||
if (size == 64) m = "sha512";
|
||||
else if (size == 32) m = "sha256";
|
||||
else if (size == 20) m = "sha1";
|
||||
else if (size == 16) m = "md5";
|
||||
else if (size == 8) m = "crc64";
|
||||
@@ -2098,11 +2091,11 @@ void Codecs_AddHashArcHandler(CCodecs *codecs)
|
||||
|
||||
// ubuntu uses "SHA256SUMS" file
|
||||
item.AddExts(UString (
|
||||
"sha256 sha512 sha224 sha384 sha1 sha md5"
|
||||
// "b2sum"
|
||||
" crc32 crc64"
|
||||
" asc"
|
||||
" cksum"
|
||||
"sha3-512 sha3-384 sha3-256 "
|
||||
"sha512 sha384 sha256 sha224 "
|
||||
"sha1 sha md5 "
|
||||
"crc32 crc64 "
|
||||
"asc cksum"
|
||||
),
|
||||
UString());
|
||||
|
||||
|
||||
@@ -242,13 +242,16 @@ static const CHashCommand g_HashCommands[] =
|
||||
{ CZipContextMenu::kHash_MD4, "MD4", "MD4" },
|
||||
{ CZipContextMenu::kHash_MD5, "MD5", "MD5" },
|
||||
{ CZipContextMenu::kHash_SHA1, "SHA-1", "SHA1" },
|
||||
{ CZipContextMenu::kHash_SHA256, "SHA-256", "SHA256" },
|
||||
{ CZipContextMenu::kHash_SHA384, "SHA-384", "SHA384" },
|
||||
{ CZipContextMenu::kHash_SHA512, "SHA-512", "SHA512" },
|
||||
{ CZipContextMenu::kHash_SHA256, "SHA2-256", "SHA256" },
|
||||
{ CZipContextMenu::kHash_SHA384, "SHA2-384", "SHA384" },
|
||||
{ CZipContextMenu::kHash_SHA512, "SHA2-512", "SHA512" },
|
||||
{ CZipContextMenu::kHash_BLAKE2sp, "BLAKE2sp", "BLAKE2sp" },
|
||||
{ CZipContextMenu::kHash_BLAKE3, "BLAKE3", "BLAKE3" },
|
||||
{ CZipContextMenu::kHash_SHA256, "SHA3-256", "SHA3-256" },
|
||||
{ CZipContextMenu::kHash_SHA384, "SHA3-384", "SHA3-384" },
|
||||
{ CZipContextMenu::kHash_SHA512, "SHA3-512", "SHA3-512" },
|
||||
{ CZipContextMenu::kHash_All, "*", "*" },
|
||||
{ CZipContextMenu::kHash_Generate_SHA256, "SHA-256 -> file.sha256", "SHA256" },
|
||||
{ CZipContextMenu::kHash_Generate_SHA256, "SHA2-256 -> file.sha256", "SHA256" },
|
||||
{ CZipContextMenu::kHash_TestArc, "Checksum : Test", "Hash" }
|
||||
};
|
||||
|
||||
@@ -966,7 +969,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
name += ".sha256";
|
||||
cmi.Folder = fs2us(folderPrefix);
|
||||
cmi.ArcName = name;
|
||||
s = "SHA-256 -> ";
|
||||
s = "SHA2-256 -> ";
|
||||
s += name;
|
||||
}
|
||||
else if (hc.CommandInternalID == kHash_TestArc)
|
||||
@@ -1231,6 +1234,9 @@ HRESULT CZipContextMenu::InvokeCommandCommon(const CCommandMapItem &cmi)
|
||||
case kHash_SHA512:
|
||||
case kHash_BLAKE2sp:
|
||||
case kHash_BLAKE3:
|
||||
case kHash_SHA3_256:
|
||||
case kHash_SHA3_384:
|
||||
case kHash_SHA3_512:
|
||||
case kHash_All:
|
||||
case kHash_Generate_SHA256:
|
||||
case kHash_TestArc:
|
||||
|
||||
@@ -59,6 +59,9 @@ public:
|
||||
kHash_SHA512,
|
||||
kHash_BLAKE2sp,
|
||||
kHash_BLAKE3,
|
||||
kHash_SHA3_256,
|
||||
kHash_SHA3_384,
|
||||
kHash_SHA3_512,
|
||||
kHash_All,
|
||||
kHash_Generate_SHA256,
|
||||
kHash_TestArc
|
||||
|
||||
Reference in New Issue
Block a user