| View previous topic :: View next topic |
| Author |
Message |
teeigeryuh Master Cheater
Reputation: 25
Joined: 13 Oct 2008 Posts: 261 Location: The netherlands
|
Posted: Tue Nov 13, 2012 6:38 pm Post subject: whats wrong with my 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; c<=key[c]; c++){
kint += key[c];
}
for(c=0; c<=priv[c]; 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; c<=userluv[c]; c++){
tempfussd[c] = userluv[c];
tempfussd[c] += kint;
tempfussd[c] *= pint;
tempfussd[c] *= tint[1];
cout << tempfussd[c];
}
cout << "\n";
//testing purposes
for(c=0; c<=userluv[c]; c++){
orig[c] = tempfussd[c];
orig[c] /= tint[1];
orig[c] /= pint;
orig[c] -= kint;
cout << orig[c];
}
return 0;
}
|
| Quote: | [4:22:08 PM] Daniel Wallace: user inputs his text, and 2 keys, keys being the password(s)
[4:23:00 PM] Daniel Wallace: the proggy generates a value according to each key and transforms it to kint and pint
[4:23:19 PM] Daniel Wallace: then according to the key values it generates yet another value based on both of them
[4:23:33 PM] Daniel Wallace: transforms the char strngs to int
[4:23:52 PM] Daniel Wallace: adds kint multiplies times pint and times tint[1]
[4:24:01 PM] Daniel Wallace: however once it does it
[4:24:08 PM] Daniel Wallace: i cant find a way to reverse it back |
_________________
ლ(╹◡╹ლ) |
|
| Back to top |
|
 |
1929394839292057839194958 Grandmaster Cheater Supreme
Reputation: 130
Joined: 22 Dec 2006 Posts: 1509
|
Posted: Tue Nov 13, 2012 7:16 pm Post subject: |
|
|
| Didn't read much but transform isn't the word you should use. You should say it converts them. gl
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Nov 13, 2012 7:26 pm Post subject: |
|
|
| lmao no you wouldn't. conversion means something completely different
|
|
| Back to top |
|
 |
Cryoma Member of the Year
Reputation: 198
Joined: 14 Jan 2009 Posts: 1819
|
Posted: Tue Nov 13, 2012 7:31 pm Post subject: |
|
|
| Slugsnack wrote: | | lmao no you wouldn't. conversion means something completely different |
mfw I agree with you
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Nov 13, 2012 7:41 pm Post subject: |
|
|
| no you don't. you saw connor get a smackdown over something that looks smart and tried to associate yourself with it.
|
|
| Back to top |
|
 |
Up2Admin I'm a spammer
Reputation: 126
Joined: 17 Oct 2007 Posts: 6549 Location: Texas
|
Posted: Tue Nov 13, 2012 7:58 pm Post subject: |
|
|
learn how to debug...
_________________
|
|
| Back to top |
|
 |
Cryoma Member of the Year
Reputation: 198
Joined: 14 Jan 2009 Posts: 1819
|
Posted: Tue Nov 13, 2012 8:09 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. |
I'm not trying to associate myself with anything, what are you talking about.
|
|
| Back to top |
|
 |
teeigeryuh Master Cheater
Reputation: 25
Joined: 13 Oct 2008 Posts: 261 Location: The netherlands
|
Posted: Tue Nov 13, 2012 8:36 pm Post subject: |
|
|
so, ideas?
_________________
ლ(╹◡╹ლ) |
|
| Back to top |
|
 |
Up2Admin I'm a spammer
Reputation: 126
Joined: 17 Oct 2007 Posts: 6549 Location: Texas
|
Posted: Tue Nov 13, 2012 8:55 pm Post subject: |
|
|
try figuring it out yourself first, use common debugging methods.
_________________
|
|
| Back to top |
|
 |
teeigeryuh Master Cheater
Reputation: 25
Joined: 13 Oct 2008 Posts: 261 Location: The netherlands
|
Posted: Tue Nov 13, 2012 9:05 pm Post subject: |
|
|
| Up2Admin wrote: | | try figuring it out yourself first, use common debugging methods. |
I know: none.
_________________
ლ(╹◡╹ლ) |
|
| Back to top |
|
 |
1929394839292057839194958 Grandmaster Cheater Supreme
Reputation: 130
Joined: 22 Dec 2006 Posts: 1509
|
Posted: Tue Nov 13, 2012 9:14 pm Post subject: |
|
|
| Slugsnack wrote: | | lmao no you wouldn't. conversion means something completely different | Well technically I suppose he's taking something and then recasting(?) it into a different variable as a different type(?) but I couldn't really think of a better word than convert.
|
|
| Back to top |
|
 |
Cryoma Member of the Year
Reputation: 198
Joined: 14 Jan 2009 Posts: 1819
|
Posted: Tue Nov 13, 2012 9:16 pm Post subject: |
|
|
| konr wrote: | | Slugsnack wrote: | | lmao no you wouldn't. conversion means something completely different | Well technically I suppose he's taking something and then recasting(?) it into a different variable as a different type(?) but I couldn't really think of a better word than convert. |
He's not converting the passwords into integers, he's generating keys based off of them.
|
|
| Back to top |
|
 |
Evil_Intentions Expert Cheater
Reputation: 65
Joined: 07 Jan 2010 Posts: 214
|
Posted: Tue Nov 13, 2012 10:19 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
teeigeryuh Master Cheater
Reputation: 25
Joined: 13 Oct 2008 Posts: 261 Location: The netherlands
|
Posted: Tue Nov 13, 2012 10:23 pm Post subject: |
|
|
| 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.
_________________
ლ(╹◡╹ლ) |
|
| Back to top |
|
 |
Evil_Intentions Expert Cheater
Reputation: 65
Joined: 07 Jan 2010 Posts: 214
|
Posted: Tue Nov 13, 2012 10:27 pm Post subject: |
|
|
| 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.
|
|
| Back to top |
|
 |
|