Re-read over those two functions and try doing them in your head with say 2 numbers, they don't make sense .-.
Hi all, i'm trying to do a simple crypter for strings. With the Crypt function i have no problem:
In the console i print the crypted string and it's all good. When i try to Decrypt it, the console doesn't print me anything. That's my function to Decrypt:Code:int lunghezza; //As globals double valori[20]; char* AltCrypt(char* string) { lunghezza = strlen(string); char* tempstring = new char[lunghezza + 1]; for (int j=0; j<lunghezza; j++) { valori[j] = atof(&string[j]); tempstring[j] = string[j] + string[j+1]; j++; } tempstring[lunghezza/2] = 0; return tempstring; }
And finally this is how i call them in the main:Code:char* AltDecrypt(char* string) { lunghezza = strlen(string); char* tempstring = new char[(lunghezza*2) + 1]; for (int j=0; j<lunghezza; j++) { tempstring[j] = valori[j]; tempstring[j+1] = string[j] - valori[j]; } tempstring[lunghezza*2] = 0; return tempstring; }
That's the result:Code:cout<<"Alt-crypting: Hi man!"<<endl; char* done = AltCrypt("Hi man!"); cout<<done; cout<<"\n\nAlt Decrypting: "<<AltDecrypt(done);
I tryed to follow the debug step by step with the breakpoints but when the compiler arrives at the Decrypt function it stops and asks me for a file(ftol2.asm). I tryed to google it but all says that it's not a problem, u can easily avoid it by put the breakpoint after that instruction. So, can anyone help me? ty in advance
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
Re-read over those two functions and try doing them in your head with say 2 numbers, they don't make sense .-.
Ah we-a blaze the fyah, make it bun dem!
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
crypt has 2x j++
Ah we-a blaze the fyah, make it bun dem!
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
Make an array of a few numbers and check the array values after each step, you'll probably figure out whats going wrong then..
Ah we-a blaze the fyah, make it bun dem!
i worked on my 2 functions, i changed something that could be wrong, now i get a decrypted string, but it's not right, it isn't the original. these are the new ones:
Code:int lunghezza; int valori[20]; char* AltCrypt(char* string) { lunghezza = strlen(string); char* tempstring = new char[lunghezza + 1]; for (int j=0; j<lunghezza; j+=2) { valori[j] = atoi(&string[j]); tempstring[j] = string[j] + string[j+1]; } tempstring[lunghezza/2] = 0; return tempstring; } char* AltDecrypt(char* string) { char* tempstring = new char[lunghezza+1]; for (int j=0; j<lunghezza; j+=2) { itoa(valori[j],&tempstring[j],10); tempstring[j+1] = string[j] - tempstring[j]; } tempstring[lunghezza] = 0; return tempstring; }
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
Many problems in your code.
First off
This dosen't do anything at all. Try outputting it in your code and you'll get 0 everytime. Do you know atoi does? It changes a STRING to an integer and I dont even know what you're trying to do.Code:valori[j] = atoi(&string[j]);
2nd issue
This piece of code is jsut as useless. itoa takes the value of the first parameter and stores it in a string. However, you're taking valori[j] and trying to store it in the address of the characterCode:itoa(valori[j],&tempstring[j],10);
Perhaps if you could try to explain your encryption method we can help you
There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi
No I do not make game hacks anymore, please stop asking.
i used atoi to get the ascii code of each char but i see that this isn't the right method... anyway my idea is to convert all the chars in the string to the ascii code and create a new (crypted) string wich will have as first char the ascii value equal to the sum of the first and second char of the original; as second the sum of the 3rd and the 4th of the original, etc etc... i used itoa to try to convert the number to the char equivalent in ascii. hope is all clear.
@flameswor10 ty for your 2 functions, they inspired me for making my ones ( not this ones xD )
for a bug of your (again xD) RandomNum function, it works very well i mean, that function works, but it generate every time the same random numbersCode:struct Command { public: char* string; bool a_crypted; void Crypt(); void Decrypt(); private: int* RandomNum(int); int* numb; }; int* Command::RandomNum(int times) { int lowest = 0, highest = 65; int* numbers = new int[times+1]; for(int j=0; j<times; j++) { int random_integer; int range=(highest-lowest)+1; random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0)); numbers[j] = random_integer; } return numbers; } void Command::Crypt() { a_crypted = true; int length = strlen(string); char* tempstring = new char[length + 1]; numb = new int[length+1]; numb = RandomNum(length); for (int j=0; j<length; j++) { int KeyStep = numb[j] + j; tempstring[j] = string[j] + KeyStep; } tempstring[length] = 0; string = tempstring; } void Command::Decrypt() { int length = strlen(string); char* tempstring = new char[length + 1]; if(a_crypted == false) { numb = new int[length+1]; numb = RandomNum(length); } for (int j=0; j<length; j++) { int KeyStep = numb[j] + j; tempstring[j] = string[j] - KeyStep; } tempstring[length] = 0; string = tempstring; }
After i did this encryption method i thought i wanted to write a function to crypt a string modifying the length of it, so here they are xD the only problem is that they don't work xD
Last edited by Sixx93; 08-13-2011 at 05:29 PM.
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
You need to seed the random function:
Code:#include <time.h> int main(void){ srand(time(NULL)); /* blahblah */ }
There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps