 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Oblivious Grandmaster Cheater Supreme
Reputation: 45
Joined: 12 Mar 2008 Posts: 1729
|
Posted: Tue Nov 13, 2012 10:37 pm Post subject: |
|
|
| Slugsnack wrote: | | no you don't. you saw connor get a smackdown over something that looks smart and tried to associate yourself with it. |
SLUGSNACK, THE HERO WE DESERVE
|
|
| Back to top |
|
 |
teeigeryuh Master Cheater
Reputation: 25
Joined: 13 Oct 2008 Posts: 260 Location: The netherlands
|
Posted: Wed Nov 14, 2012 12:39 am Post subject: |
|
|
| Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | Could you possibly be overflowing a char?
So like, after multiplying and whatever, you go over 255 so it basically wraps around. Then when you perform the reverse arithmetic, it results in something completely different. |
To fix that I transformed char to int, and all the shit is done to int. then once you need to decrypt it, it sets it back to w/e it was and transforms back to char. |
orig[] isn't int, it's char. When you're setting orig[c]=tempfused[c], you're downcasting. Then all the arithmetic from that point is being done on a char. Have orig[] be of type int, then when you print out, cast it to a char. |
HOLY SHAT, YOU FUCKING FIX'D IT
HOW COULD I BE SO STUPID HOLY FUCK.
I forgot that completely
The point of orig was to build a decrypt function, like for me to test and check out if it actually worked.
|
|
| Back to top |
|
 |
Up2Admin I'm a spammer
Reputation: 126
Joined: 17 Oct 2007 Posts: 6550 Location: Texas
|
Posted: Wed Nov 14, 2012 4:34 am Post subject: |
|
|
Sure is Safko being mad because he won an argument in a previous thread I posted in.
also
| teeigeryuh wrote: | | Up2Admin wrote: | | try figuring it out yourself first, use common debugging methods. |
I know: none. | Didn't really look through your code, but I'm assuming C++.
http://www.gamedev.net/page/resources/_/technical/general-programming/c-debugging-r1344
In this case however, debugging probably wouldn't have helped much (or maybe it would have, idk). It's still good to attempt to find the source of the problem on your own (good learning experience imo).
_________________
|
|
| Back to top |
|
 |
orlaub How do I cheat?
Reputation: 0
Joined: 04 Oct 2012 Posts: 4
|
Posted: Wed Nov 14, 2012 8:46 am Post subject: |
|
|
| Yeah.. you don't c++ without a debugger.. that's just immensely stupid.
|
|
| Back to top |
|
 |
SFP+ Comp. talk moderator
Reputation: 26
Joined: 02 May 2007 Posts: 1228 Location: Sweden
|
Posted: Wed Nov 14, 2012 8:59 am Post subject: |
|
|
| Up2Admin wrote: | | Sure is Safko being mad because he won an argument in a previous thread I posted in. | Why would I be mad when I won lmao
It was a douchy response and as you've probably noticed I've found you being just that for several months. The aforementioned argument was merely a trigger to make me have a go at you for the first time.
Don't even get why you bring it up in this thread either. I'm certain I'm not the only one that has derepped you during your visit at CEF.
|
|
| Back to top |
|
 |
Up2Admin I'm a spammer
Reputation: 126
Joined: 17 Oct 2007 Posts: 6550 Location: Texas
|
Posted: Wed Nov 14, 2012 4:48 pm Post subject: |
|
|
| Safko wrote: | | Up2Admin wrote: | | Sure is Safko being mad because he won an argument in a previous thread I posted in. | Why would I be mad when I won lmao
It was a douchy response and as you've probably noticed I've found you being just that for several months. The aforementioned argument was merely a trigger to make me have a go at you for the first time.
Don't even get why you bring it up in this thread either. I'm certain I'm not the only one that has derepped you during your visit at CEF. | I don't tend to get derepped by people I have no problem with. Nor do I tend to get called a douche by people I have no problem with.
_________________
|
|
| Back to top |
|
 |
Evil_Intentions Expert Cheater
Reputation: 65
Joined: 07 Jan 2010 Posts: 214
|
Posted: Wed Nov 14, 2012 5:27 pm Post subject: |
|
|
| teeigeryuh wrote: | | Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | Could you possibly be overflowing a char?
So like, after multiplying and whatever, you go over 255 so it basically wraps around. Then when you perform the reverse arithmetic, it results in something completely different. |
To fix that I transformed char to int, and all the shit is done to int. then once you need to decrypt it, it sets it back to w/e it was and transforms back to char. |
orig[] isn't int, it's char. When you're setting orig[c]=tempfused[c], you're downcasting. Then all the arithmetic from that point is being done on a char. Have orig[] be of type int, then when you print out, cast it to a char. |
HOLY SHAT, YOU FUCKING FIX'D IT
HOW COULD I BE SO STUPID HOLY FUCK.
I forgot that completely
The point of orig was to build a decrypt function, like for me to test and check out if it actually worked. |
Yea, also, why are you iterating through your arrays like that? With the conditional statment being c<=userluv[c]? That means if, for example, you had a space character anywhere after the 32nd position, the loop would end. This applies to an 'a' after the 97th position, a 'K' after the 75th, etc. You should either loop until you get to a null character (userluv[c]!=0) or loop until the end of the array (c<800).
|
|
| Back to top |
|
 |
teeigeryuh Master Cheater
Reputation: 25
Joined: 13 Oct 2008 Posts: 260 Location: The netherlands
|
Posted: Wed Nov 14, 2012 6:21 pm Post subject: |
|
|
| Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | Could you possibly be overflowing a char?
So like, after multiplying and whatever, you go over 255 so it basically wraps around. Then when you perform the reverse arithmetic, it results in something completely different. |
To fix that I transformed char to int, and all the shit is done to int. then once you need to decrypt it, it sets it back to w/e it was and transforms back to char. |
orig[] isn't int, it's char. When you're setting orig[c]=tempfused[c], you're downcasting. Then all the arithmetic from that point is being done on a char. Have orig[] be of type int, then when you print out, cast it to a char. |
HOLY SHAT, YOU FUCKING FIX'D IT
HOW COULD I BE SO STUPID HOLY FUCK.
I forgot that completely
The point of orig was to build a decrypt function, like for me to test and check out if it actually worked. |
Yea, also, why are you iterating through your arrays like that? With the conditional statment being c<=userluv[c]? That means if, for example, you had a space character anywhere after the 32nd position, the loop would end. This applies to an 'a' after the 97th position, a 'K' after the 75th, etc. You should either loop until you get to a null character (userluv[c]!=0) or loop until the end of the array (c<800). |
if space = 0, wouldn't userluv[c]!=0 stop the moment the loop hits a space?
|
|
| Back to top |
|
 |
Evil_Intentions Expert Cheater
Reputation: 65
Joined: 07 Jan 2010 Posts: 214
|
Posted: Wed Nov 14, 2012 6:28 pm Post subject: |
|
|
| teeigeryuh wrote: | | Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | Could you possibly be overflowing a char?
So like, after multiplying and whatever, you go over 255 so it basically wraps around. Then when you perform the reverse arithmetic, it results in something completely different. |
To fix that I transformed char to int, and all the shit is done to int. then once you need to decrypt it, it sets it back to w/e it was and transforms back to char. |
orig[] isn't int, it's char. When you're setting orig[c]=tempfused[c], you're downcasting. Then all the arithmetic from that point is being done on a char. Have orig[] be of type int, then when you print out, cast it to a char. |
HOLY SHAT, YOU FUCKING FIX'D IT
HOW COULD I BE SO STUPID HOLY FUCK.
I forgot that completely
The point of orig was to build a decrypt function, like for me to test and check out if it actually worked. |
Yea, also, why are you iterating through your arrays like that? With the conditional statment being c<=userluv[c]? That means if, for example, you had a space character anywhere after the 32nd position, the loop would end. This applies to an 'a' after the 97th position, a 'K' after the 75th, etc. You should either loop until you get to a null character (userluv[c]!=0) or loop until the end of the array (c<800). |
if space = 0, wouldn't userluv[c]!=0 stop the moment the loop hits a space? |
oh god...
The ASCII value of a space character is 32. The value for an 'a' is 97, for 'K' it's 75 etc. A space is not 0, a null character is 0. IIRC, when you make a char array, it's filled with null character, so looping until the first null character will only read the string.
|
|
| Back to top |
|
 |
teeigeryuh Master Cheater
Reputation: 25
Joined: 13 Oct 2008 Posts: 260 Location: The netherlands
|
Posted: Wed Nov 14, 2012 7:10 pm Post subject: |
|
|
| Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | | teeigeryuh wrote: | | Evil_Intentions wrote: | Could you possibly be overflowing a char?
So like, after multiplying and whatever, you go over 255 so it basically wraps around. Then when you perform the reverse arithmetic, it results in something completely different. |
To fix that I transformed char to int, and all the shit is done to int. then once you need to decrypt it, it sets it back to w/e it was and transforms back to char. |
orig[] isn't int, it's char. When you're setting orig[c]=tempfused[c], you're downcasting. Then all the arithmetic from that point is being done on a char. Have orig[] be of type int, then when you print out, cast it to a char. |
HOLY SHAT, YOU FUCKING FIX'D IT
HOW COULD I BE SO STUPID HOLY FUCK.
I forgot that completely
The point of orig was to build a decrypt function, like for me to test and check out if it actually worked. |
Yea, also, why are you iterating through your arrays like that? With the conditional statment being c<=userluv[c]? That means if, for example, you had a space character anywhere after the 32nd position, the loop would end. This applies to an 'a' after the 97th position, a 'K' after the 75th, etc. You should either loop until you get to a null character (userluv[c]!=0) or loop until the end of the array (c<800). |
if space = 0, wouldn't userluv[c]!=0 stop the moment the loop hits a space? |
oh god...
The ASCII value of a space character is 32. The value for an 'a' is 97, for 'K' it's 75 etc. A space is not 0, a null character is 0. IIRC, when you make a char array, it's filled with null character, so looping until the first null character will only read the string. |
o, my bad
anyways, here's my current code:
[/code] #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
char userluv[800], orig[800], key [51], priv [21];
int tempfussd[800], kint, pint, tint[5], c;
//get the basic info
cout << "key? ";
gets(key);
cout << "Second key? ";
gets(priv);
cout << "Your lovely text?:";
gets(userluv);
for(c=0; key[c]!=0; c++){
kint += key[c];
}
for(c=0; priv[c]!=0; c++){
pint += priv[c];
}
//do shit to your key
tint[0] = strlen(key) + strlen(priv);
tint[1] = tint[0] * tint[0];
//string to int then do shit :S
for(c=0; userluv[c]!=0; c++){
tempfussd[c] = userluv[c];
tempfussd[c] += kint;
tempfussd[c] *= pint;
tempfussd[c] *= tint[1];
cout << tempfussd[c];
}
cout << "\n\n\n";
//test
for(c=0; tempfussd[c]!=0; c++){
tempfussd[c] /= tint[1];
tempfussd[c] /= pint;
tempfussd[c] -=kint;
orig[c] = tempfussd[c];
cout << orig[c];
}
return 0;
}
[/code]
why am I getting gibberish after my text?
|
|
| Back to top |
|
 |
Evil_Intentions Expert Cheater
Reputation: 65
Joined: 07 Jan 2010 Posts: 214
|
Posted: Wed Nov 14, 2012 7:41 pm Post subject: |
|
|
You're not initializing your arrays, so they're filled with junk to initialize an array to zeros, have like
char orig[800]={0};
This will set the first value to 0, and initializing the first value of an array should make all other values 0; You will need to do this for all arrays, in fact, because of how it is now, you wouldn't likely get the same encoded output on two different runs using the same exact phrase and keys.
|
|
| Back to top |
|
 |
:^( Grandmaster Cheater
Reputation: 109
Joined: 25 May 2007 Posts: 689
|
Posted: Wed Nov 14, 2012 7:45 pm Post subject: |
|
|
he's stealthing you into making fractals dont listen to him
_________________
|
|
| Back to top |
|
 |
br0l0ck Cheater
Reputation: 63
Joined: 15 Aug 2007 Posts: 36
|
Posted: Wed Nov 14, 2012 7:47 pm Post subject: |
|
|
| to code you must first stare into a fractal for 25 minutes
|
|
| Back to top |
|
 |
Evil_Intentions Expert Cheater
Reputation: 65
Joined: 07 Jan 2010 Posts: 214
|
Posted: Wed Nov 14, 2012 7:49 pm Post subject: |
|
|
;-; but guis i noe wut im sayin dhoe.
Actually, you only have to initialize tempfussed[], kint, and pint
Sorry about that, I forgot how input works in c++.
Alternatively, do dat shit in java:
| Code: | import java.util.Scanner;
public class Encrypt {
public static void main(String[] args) {
char input[], orig[], key[], priv[];
int tF[], kint=0, pint=0, tint[]=new int[5];
Scanner in = new Scanner(System.in);
System.out.print("1st Key: ");
key = in.nextLine().toCharArray();
System.out.print("2nd Key: ");
priv = in.nextLine().toCharArray();
System.out.print("Message: ");
input = in.nextLine().toCharArray();
tF = new int[input.length];
orig = new char[input.length];
for(char c:key)
kint+=c;
for(char c:priv)
pint+=c;
tint[0] = key.length+priv.length;
tint[1] = tint[0]*tint[0];
for(int i=0;i<input.length;i++){
tF[i] = (input[i]+kint)*pint*tint[1];
System.out.print(tF[i]);
}
System.out.println();
for(int i=0;i<tF.length;i++){
orig[i] = (char) (tF[i]/tint[1]/pint-kint);
System.out.print(orig[i]);
}
System.out.println();
}
}
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|