62 lines
1.2 KiB
C++
62 lines
1.2 KiB
C++
// NpcManager_encrypt.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include <fstream>
|
|
#include <conio.h>
|
|
#include <iostream>
|
|
#include "../../Utility/AuMD5Encrypt.h"
|
|
|
|
using namespace std;
|
|
|
|
#define NPCMANAGER_HASHKEY "npcmanager_key"
|
|
|
|
int _tmain(int argc, _TCHAR* argv[])
|
|
{
|
|
if (argc < 2)
|
|
{
|
|
printf("input file name...\r\n");
|
|
_getch();
|
|
return 0;
|
|
}
|
|
|
|
printf("%s\n", argv[1]);
|
|
|
|
fstream file;
|
|
string filename = argv[1];
|
|
file.open(filename.c_str(), ios::in | ios::out | ios::binary);
|
|
if(!file)
|
|
{
|
|
printf("file open error\n");
|
|
_getch();
|
|
return NULL;
|
|
}
|
|
|
|
file.seekg(0, ios::end);
|
|
size_t size = file.tellg();
|
|
char* buffer = new char[size];
|
|
|
|
file.seekg(0, ios::beg);
|
|
file.read(buffer, (unsigned int)size);
|
|
|
|
AuMD5Encrypt crypt;
|
|
//crypt.DecryptString(HashKey, buffer, (unsigned int)size);
|
|
if(!crypt.DecryptString(NPCMANAGER_HASHKEY, buffer, (unsigned int)size))
|
|
{
|
|
_getch();
|
|
return 0;
|
|
}
|
|
|
|
file.seekp(0, ios::beg);
|
|
file.write(buffer, (unsigned int)size);
|
|
file.close();
|
|
|
|
if(buffer)
|
|
delete[] buffer;
|
|
|
|
printf("done...\n");
|
|
_getch();
|
|
return 0;
|
|
}
|
|
|