hi everyone..i need to crack a symmetric key by implementing a method called CrackSymmetricKey
I must use the TEA encryption algorithm below:

union myMsgType{
		unsigned long textConverted[2];
		char text[9];
};

class TEA_Algorithm  
{
public:
	void CrackSymmetricKey(union myMsgType plaintext, union myMsgType ciphertext);
	void Decrypt(unsigned long k[], unsigned long ciphertext[], unsigned long plaintext[]);
	void Encrypt(unsigned long k[], unsigned long plaintext[], unsigned long ciphertext[]);
	TEA_Algorithm() {};
	virtual ~TEA_Algorithm() {};

};

As input, im given the following ciphertext and i need to find the secret key that has been used to obtain this ciphertext, and hence, deduce the original plaintext.
// myCiphertext.textConverted[0] = 2022673309;
// myCiphertext.textConverted[1] = 3810199360;

#include "stdafx.h" 
#include <iostream>
#include <string.h>
using namespace std;

#include "TEA_Algorithm.h"

void TEA_Algorithm::Encrypt(unsigned long k[], unsigned long plaintext[], unsigned long ciphertext[])
{
unsigned long y = plaintext[0], z = plaintext[1];
	unsigned long delta = 0x9e3779b9, sum = 0; int n;
	for (n= 0; n < 32; n++) {
		sum += delta;
		y += ((z << 4) + k[0]) ^ (z+sum) ^ ((z >> 5) + k[1]);        
		z += ((y << 4) + k[2]) ^ (y+sum) ^ ((y >> 5) + k[3]);        
	}
	ciphertext[0] = y;  ciphertext[1] = z; 

}

void TEA_Algorithm::Decrypt(unsigned long k[], unsigned long ciphertext[], unsigned long plaintext[])
{
unsigned long y = ciphertext[0], z = ciphertext[1];
	unsigned long delta = 0x9e3779b9, sum = delta << 5;  int n;
	for (n= 0; n < 32; n++) {
		z -= ((y << 4) + k[2]) ^ (y + sum) ^ ((y >> 5) + k[3]);
		y -= ((z << 4) + k[0]) ^ (z + sum) ^ ((z >> 5) + k[1]);
		sum -= delta;
	}
	plaintext[0] = y; plaintext[1] = z;
}

void TEA_Algorithm::CrackSymmetricKey(union myMsgType plaintext, union myMsgType ciphertext)
{
	void CrackSymmetricKey(union c);
/* 
 what should i write here if this is what's given:
	plaintext:= security
	ciphertext: 	
		myCiphertext.textConverted[0] = 2022673309;
		myCiphertext.textConverted[1] = 3810199360;

	additional information: key[0]=key[1]=k[2]=k[3]
 and you're asked to determine what is the secret key that 
 has been used to encrypt this plaintext.
*/

}

plz help..i know i should make a loop inside but im very weak in programming

Recommended Answers

All 4 Replies

> .i know i should make a loop inside but im very weak in programming
You'd better be a demon cryptographer then.
Without one or the other, this seems a hard problem.

Hah. There's whole courses on stuff like this. I'd sugguest you take one if you really plan on writing this. Or pull your hair out!

hi ..
am having the same problem .. and the doctor asked us to complete the crack .. if any body know any thing that may help me in it plz plz ..

Is it a joke? Are you sure that it's possibble to crack a cipher if you can compose some method name like

class CrackAllTheWorld {
public:
    bool InvokeSuperCracker(void* ciphertext) {
           return true;
    }
};

Better download this article on TEA cryptanalysis topic:
http://cs.ua.edu/SecurityResearchGroup/VRAndem.pdf
(~1.73Mb). May be it helps...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.