- moved MD4 calculator out of backend.

Only map hacks use MD4, this does not need to be shared.
This commit is contained in:
Christoph Oelckers 2021-04-25 11:29:24 +02:00
parent ad28630df6
commit 79875d44e0
2 changed files with 30 additions and 28 deletions

View file

@ -52,7 +52,6 @@
#include "version.h"
#include "findfile.h"
#include "md5.h"
#include "md4.h"
extern FILE* Logfile;
@ -319,33 +318,6 @@ CCMD (md5sum)
}
}
CCMD(md4sum)
{
if (argv.argc() < 2)
{
Printf("Usage: md4sum <file> ...\n");
}
for (int i = 1; i < argv.argc(); ++i)
{
FileReader fr = fileSystem.OpenFileReader(argv[i]);
if (!fr.isOpen())
{
Printf("%s: %s\n", argv[i], strerror(errno));
}
else
{
auto data = fr.Read();
uint8_t digest[16];
md4once(data.Data(), data.Size(), digest);
for (int j = 0; j < 16; ++j)
{
Printf("%02x", digest[j]);
}
Printf(" //*%s\n", argv[i]);
}
}
}
CCMD(printlocalized)
{
if (argv.argc() > 1)

View file

@ -35,6 +35,8 @@
#include "build.h"
#include "sc_man.h"
#include "printf.h"
#include "c_dispatch.h"
#include "md4.h"
static TArray<usermaphack_t> usermaphacks;
TArray<int> blockingpairs[MAXWALLS];
@ -368,3 +370,31 @@ void G_LoadMapHack(const char* filename, const unsigned char* md4)
}
}
// Map hacks use MD4 instead of MD5. Oh, well...
CCMD(md4sum)
{
if (argv.argc() < 2)
{
Printf("Usage: md4sum <file> ...\n");
}
for (int i = 1; i < argv.argc(); ++i)
{
FileReader fr = fileSystem.OpenFileReader(argv[i]);
if (!fr.isOpen())
{
Printf("%s: %s\n", argv[i], strerror(errno));
}
else
{
auto data = fr.Read();
uint8_t digest[16];
md4once(data.Data(), data.Size(), digest);
for (int j = 0; j < 16; ++j)
{
Printf("%02x", digest[j]);
}
Printf(" //*%s\n", argv[i]);
}
}
}