Emu/source/common/crypto/Crypto.cpp

31 lines
638 B
C++

// Copyright (C) 2007-2025 EQ2EMulator
// Licensed under GPL v3
#include "Crypto.h"
#include <iostream>
#include "../common/packet_dump.h"
using namespace std;
void test();
int64 Crypto::RSADecrypt(uchar* text, int16 size){
int64 ret = 0;
uchar* buffer = new uchar[8];
for(int i=7;i>=0;i--)
buffer[7-i] = text[i];
memcpy(&ret, buffer, 8);
safe_delete_array(buffer);
return ret;
}
void Crypto::RC4Decrypt(uchar* text, int32 size){
MCrypto.lock();
client->Cypher(text, size);
MCrypto.unlock();
}
void Crypto::RC4Encrypt(uchar* text, int32 size){
MCrypto.lock();
server->Cypher(text, size);
MCrypto.unlock();
}