forked from organicmaps/organicmaps
Remove unused sha224, sha384, sha512 functions because they are linked into code.
This commit is contained in:
parent
20add5eeaf
commit
8d5b26990e
3 changed files with 0 additions and 80 deletions
|
@ -10,10 +10,7 @@ CONFIG += staticlib
|
|||
DEFINES += LTC_NO_ROLC
|
||||
|
||||
SOURCES += \
|
||||
src/hashes/sha2/sha224.c \
|
||||
src/hashes/sha2/sha256.c \
|
||||
src/hashes/sha2/sha384.c \
|
||||
src/hashes/sha2/sha512.c \
|
||||
|
||||
HEADERS += \
|
||||
src/headers/tomcrypt.h \
|
||||
|
|
|
@ -3,14 +3,6 @@
|
|||
|
||||
#include "../sha2.hpp"
|
||||
|
||||
UNIT_TEST(Sha2_224)
|
||||
{
|
||||
TEST_EQUAL(sha2::digest224("Hello, world!"),
|
||||
"8552D8B7A7DC5476CB9E25DEE69A8091290764B7F2A64FE6E78E9568", ());
|
||||
TEST_EQUAL(sha2::digest224(""),
|
||||
"D14A028C2A3A2BC9476102BB288234C415A2B01F828EA62AC5B3E42F", ());
|
||||
}
|
||||
|
||||
UNIT_TEST(Sha2_256)
|
||||
{
|
||||
TEST_EQUAL(sha2::digest256("Hello, world!"),
|
||||
|
@ -21,23 +13,3 @@ UNIT_TEST(Sha2_256)
|
|||
TEST_EQUAL(sha2::digest256("b", false),
|
||||
string(zero, ARRAY_SIZE(zero) - 1), ());
|
||||
}
|
||||
|
||||
UNIT_TEST(Sha2_384)
|
||||
{
|
||||
TEST_EQUAL(sha2::digest384("Hello, world!"),
|
||||
"55BC556B0D2FE0FCE582BA5FE07BAAFFF035653638C7AC0D5494C2A64C0BEA1CC"
|
||||
"57331C7C12A45CDBCA7F4C34A089EEB", ());
|
||||
TEST_EQUAL(sha2::digest384(""),
|
||||
"38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA2"
|
||||
"74EDEBFE76F65FBD51AD2F14898B95B", ());
|
||||
}
|
||||
|
||||
UNIT_TEST(Sha2_512)
|
||||
{
|
||||
TEST_EQUAL(sha2::digest512(""),
|
||||
"CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE"
|
||||
"47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E", ());
|
||||
TEST_EQUAL(sha2::digest512("Hello, world!"),
|
||||
"C1527CD893C124773D811911970C8FE6E857D6DF5DC9226BD8A160614C0CD963"
|
||||
"A4DDEA2B94BB7D36021EF9D865D5CEA294A82DD49A0BB269F51F6E7A57F79421", ());
|
||||
}
|
||||
|
|
|
@ -7,22 +7,6 @@
|
|||
|
||||
namespace sha2
|
||||
{
|
||||
string digest224(char const * data, size_t dataSize, bool returnAsHexString)
|
||||
{
|
||||
hash_state md;
|
||||
unsigned char out[224/8] = { 0 };
|
||||
if (CRYPT_OK == sha224_init(&md)
|
||||
&& CRYPT_OK == sha224_process(&md, reinterpret_cast<unsigned char const *>(data), dataSize)
|
||||
&& CRYPT_OK == sha224_done(&md, out))
|
||||
{
|
||||
if (returnAsHexString)
|
||||
return ToHex(string(reinterpret_cast<char const *>(out), ARRAY_SIZE(out)));
|
||||
else
|
||||
return string(reinterpret_cast<char const *>(out), ARRAY_SIZE(out));
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
string digest256(char const * data, size_t dataSize, bool returnAsHexString)
|
||||
{
|
||||
hash_state md;
|
||||
|
@ -38,37 +22,4 @@ namespace sha2
|
|||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
string digest384(char const * data, size_t dataSize, bool returnAsHexString)
|
||||
{
|
||||
hash_state md;
|
||||
unsigned char out[384/8] = { 0 };
|
||||
if (CRYPT_OK == sha384_init(&md)
|
||||
&& CRYPT_OK == sha384_process(&md, reinterpret_cast<unsigned char const *>(data), dataSize)
|
||||
&& CRYPT_OK == sha384_done(&md, out))
|
||||
{
|
||||
if (returnAsHexString)
|
||||
return ToHex(string(reinterpret_cast<char const *>(out), ARRAY_SIZE(out)));
|
||||
else
|
||||
return string(reinterpret_cast<char const *>(out), ARRAY_SIZE(out));
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
string digest512(char const * data, size_t dataSize, bool returnAsHexString)
|
||||
{
|
||||
hash_state md;
|
||||
unsigned char out[512/8] = { 0 };
|
||||
if (CRYPT_OK == sha512_init(&md)
|
||||
&& CRYPT_OK == sha512_process(&md, reinterpret_cast<unsigned char const *>(data), dataSize)
|
||||
&& CRYPT_OK == sha512_done(&md, out))
|
||||
{
|
||||
if (returnAsHexString)
|
||||
return ToHex(string(reinterpret_cast<char const *>(out), ARRAY_SIZE(out)));
|
||||
else
|
||||
return string(reinterpret_cast<char const *>(out), ARRAY_SIZE(out));
|
||||
}
|
||||
return string();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue