Files
Client/GameTools/Z3SCrypt/Z3SCrypt.cpp
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

132 lines
2.0 KiB
C++

// Z3SCrypt.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
//
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <Windows.h>
using namespace std;
char * enckey = "cjsgkdmlTlqkfshaemfdmlwktlsdjqtsmsgkfn";
void Encrypt(char * filein, char * fileout)
{
// 처음 256바이트는 헤더
ifstream in (filein, ios::in|ios::binary);
DeleteFileA(fileout);
ofstream out (fileout, ios::out|ios::app|ios::binary);
if ( (in.is_open()) && (out.is_open()) ){
char a;
int counter = 0;
for(int i = 0; i < 256; ++i)
{
in.get(a);
out.put(a);
}
while (in.get(a))
{
if (counter == ((sizeof(enckey) / sizeof(char)) - 1))
{
counter = 0;
}
a = ((a ^ enckey[counter]) + counter);
out.put(a);
counter++;
}
}
else
{
printf("Could not open input or output file.");
}
in.close();
out.close();
printf("Done.\n");
system("pause");
}
void Decrypt(char * filein, char * fileout)
{
// 처음 256바이트는 헤더
ifstream in (filein, ios::in|ios::binary);
DeleteFileA(fileout);
ofstream out (fileout, ios::out|ios::app|ios::binary);
if ( (in.is_open()) && (out.is_open()) )
{
char a;
int counter = 0;
for(int i = 0; i < 256; ++i)
{
in.get(a);
out.put(a);
}
while (in.get(a))
{
if (counter == ((sizeof(enckey) / sizeof(char)) - 1))
{
counter = 0;
}
a = ((a - counter) ^ enckey[counter]);
out.put(a);
counter++;
}
}
else
{
printf("Could not open input or output file.");
}
in.close();
out.close();
printf("Done.\n");
system("pause");
}
int main(int argc, char* argv[])
{
printf("ROW Z3S Crypt v1.0\n\n");
if(argc < 4)
{
printf("z3scrypt.exe cryptname inputfile outputfile\n\n");
printf("ex) z3scrypt.exe encrypt zone1.z3s zone1.cry\n\n");
return 0;
}
if(_stricmp(argv[1], "encrypt") == 0)
{
Encrypt(argv[2], argv[3]);
}
else if(_stricmp(argv[1], "decrypt") == 0)
{
Decrypt(argv[2], argv[3]);
}
else
{
printf("No such option.\n\n");
}
printf("done.\n\n");
return 0;
}