Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › [Help] typedef structure

[Help] typedef structure

Posts 1–6 of 6 · Page 1 of 1
FA
faceofdevil
[Help] typedef structure
i've got a typedef struct built into a header file and im trying to link it 2 seperate .cpp files..


crypt.cpp

Code:
#include "crypt.h"
#define MAX_RC5_KEY				16

RC5_32_KEY RC5_32_KEY_TABLE[MAX_RC5_KEY];

BYTE SY_KEY_TABLE[16][4]=
{
	{ 0x17,0xb3,0x67,0xaa },	//0
	{ 0x53,0xf2,0x74,0xb1 },	//1
	{ 0x8c,0x72,0x59,0x32 },	//2
	{ 0x98,0xea,0x55,0x29 },	//3
	{ 0x4B,0x1C,0x15,0x11 },	//4
	{ 0xE8,0x9B,0x3A,0x8A },	//5
	{ 0x0F,0xAD,0x37,0x6C },	//6
	{ 0xD9,0x64,0x28,0x5C },	//7
	{ 0xB3,0xB7,0xEC,0x7B },	//8
	{ 0x9C,0x13,0xFE,0xF5 },	//9
	{ 0x5C,0x55,0x6A,0xD8 },	//10
	{ 0x6C,0xA9,0xDB,0x64 },	//11
	{ 0x5A,0xBE,0xF2,0xF6 },	//12
	{ 0xA6,0x4D,0x8F,0xB9 },	//13
	{ 0x67,0x9F,0x7D,0xF6 },	//14
	{ 0xCA,0x6A,0xA9,0xEF },	//15
};

BYTE SY_RKEY_TABLE[16][4]=
{
	{ 0xC0,0x3C,0x06,0xEA },	//0
	{ 0xB9,0x78,0xB3,0x45 },	//1
	{ 0x88,0x48,0xC0,0x71 },	//2
	{ 0x85,0x4C,0xB6,0xE7 },	//3
	{ 0x98,0xAE,0xD9,0xBF },	//4
	{ 0x2D,0x83,0x06,0x55 },	//5
	{ 0x44,0x95,0xAF,0x99 },	//6
	{ 0x43,0xC8,0x53,0x63 },	//7
	{ 0x3B,0xB1,0x60,0x0B },	//8
	{ 0x19,0x2D,0x57,0xC6 },	//9
	{ 0x68,0xCC,0x56,0x3A },	//10
	{ 0x5C,0xF8,0x90,0x4A },	//11
	{ 0xA1,0x8A,0x0B,0x70 },	//12
	{ 0x28,0x45,0x80,0xB1 },	//13
	{ 0x71,0x9D,0x4A,0x80 },	//14
	{ 0x54,0x1B,0x0F,0x9C },	//15
};

CCrypt::CCrypt( )
{
	RC5_32_KEY*   rc532Key  = RC5_32_KEY_TABLE;		//
	unsigned char tiv1[ 4 ] = {'n','o','o','b'};	//
	unsigned char tiv2[ 4 ] = {'n','o','o','b'};	//
	DWORD         skey[ 2 ];						// 4Byte * 2  = 64bit

	memset( RC5_32_KEY_TABLE, 0, sizeof(RC5_32_KEY_TABLE) );

	for ( int i = 0; i < MAX_RC5_KEY; i++, rc532Key++ )
	{
		skey[ 0 ] = (*(DWORD*)(SY_RKEY_TABLE + i)) ^ (*(DWORD*)tiv1);
		skey[ 1 ] = (*(DWORD*)(SY_RKEY_TABLE + i)) ^ (*(DWORD*)tiv2);

		RC5_32_set_key( rc532Key, sizeof(skey), (unsigned char*)&skey, RC5_8_ROUNDS );
	}
	Log( MSG_INFO, "Key table has been created!" );
}

CCrypt::~CCrypt( )
{
}

void CCrypt::Decrypt(BYTE* ptr, RC5_32_KEY key)
{
	
	unsigned char tiv[8] = {'n','o','o','b','n','o','o','b'};
	int           num    = 0;

	LONG  decryptlen = ((CPacket*)ptr)->Size;
	BYTE* decryptptr = ptr;

	decryptlen -= PHLen;
	decryptptr += PHLen;

	if ( decryptlen > 0 )
	{
		RC5_32_cfb64_encrypt( decryptptr, decryptptr, decryptlen, &key, tiv, &num, RC5_DECRYPT );
	}
}

void CCrypt::Encrypt(BYTE* ptr, RC5_32_KEY key)
{
	CPacket* pak;
	unsigned char tiv[8] = {'n','o','o','b','n','o','o','b'};
	int           num    = 0;

	LONG  encryptlen = ((CPacket*)ptr)->Size;
	BYTE* encryptptr = ptr;

	encryptlen -= PHLen;
	encryptptr += PHLen;

	if ( encryptlen > 0 )
	{
		RC5_32_cfb64_encrypt( encryptptr, encryptptr, encryptlen, &key, tiv, &num, RC5_ENCRYPT);
	}
}
crypt.h

Code:
#ifndef __CRYPT_
#define __CRYPT_

#include "rc5.h"

class CCrypt
{
public:
	CCrypt( );
	~CCrypt( );

	
	void Decrypt( BYTE* ptr, RC5_32_KEY key );
	void Encrypt(BYTE* ptr, RC5_32_KEY key);
	
	
};
Now here is my problem.


main.cpp
Code:
unsigned char* buffer;
Decrypt( buffer, RC5_32_KEY_TABLE[ 0 ] );
now of course we get this error

error C2065: 'RC5_32_KEY_TABLE' : undeclared identifier

wich means theres no refence to it inside the .cpp

how can i call the refence to 'RC5_32_KEY_TABLE' without calling it twice wich you cant do.
#1 · 15y ago
-Raz0r-
-Raz0r-
RC5_32_KEY_TABLE doesn't exist in that context.
You'll need to hint to the compiler/linker that it exists in another file. Look up the 'extern' keyword
#2 · 15y ago
FA
faceofdevil
how would i go about extern a typedef a struct.

Code:
typedef struct rc5_key_st
{
	/* Number of rounds */
	int rounds;
	RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
} RC5_32_KEY;
is it possible to extern
Code:
 RC5_32_KEY RC5_32_KEY_TABLE[MAX_RC5_KEY];
#3 · edited 15y ago · 15y ago
Hell_Demon
Hell_Demon
extern RC5_32_KEY RC5_32_KEY_TABLE[MAX_RC5_KEY]; ?
#4 · 15y ago
FA
faceofdevil
1>crypt.obj : error LNK2001: unresolved external symbol "struct rc5_key_st * RC5_32_KEY_TABLE" (?RC5_32_KEY_TABLE@@3PAUrc5_key_st@@A)
#5 · 15y ago
Hell_Demon
Hell_Demon
new header(dfksfj.h)
Code:
#pragma once

typedef struct rc5_key_st
{
	/* Number of rounds */
	int rounds;
	RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
} RC5_32_KEY;

RC5_32_KEY RC5_32_KEY_TABLE[MAX_RC5_KEY];
Whereever you need the RC5_32_KEY_TABLE:
Code:
#include "dfksfj.h"
...
#6 · 15y ago
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Tags for this Thread

None