Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


whats wrong with my code?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam
View previous topic :: View next topic  
Author Message
teeigeryuh
Master Cheater
Reputation: 25

Joined: 13 Oct 2008
Posts: 261
Location: The netherlands

PostPosted: Tue Nov 13, 2012 6:38 pm    Post subject: whats wrong with my code? Reply with quote

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
View user's profile Send private message
1929394839292057839194958
Grandmaster Cheater Supreme
Reputation: 130

Joined: 22 Dec 2006
Posts: 1509

PostPosted: Tue Nov 13, 2012 7:16 pm    Post subject: Reply with quote

Didn't read much but transform isn't the word you should use. You should say it converts them. gl
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Nov 13, 2012 7:26 pm    Post subject: Reply with quote

lmao no you wouldn't. conversion means something completely different
Back to top
View user's profile Send private message
Cryoma
Member of the Year
Reputation: 198

Joined: 14 Jan 2009
Posts: 1819

PostPosted: Tue Nov 13, 2012 7:31 pm    Post subject: Reply with quote

Slugsnack wrote:
lmao no you wouldn't. conversion means something completely different

mfw I agree with you
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Nov 13, 2012 7:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
Up2Admin
I'm a spammer
Reputation: 126

Joined: 17 Oct 2007
Posts: 6549
Location: Texas

PostPosted: Tue Nov 13, 2012 7:58 pm    Post subject: This post has 1 review(s) Reply with quote

learn how to debug...
_________________
Back to top
View user's profile Send private message Visit poster's website
Cryoma
Member of the Year
Reputation: 198

Joined: 14 Jan 2009
Posts: 1819

PostPosted: Tue Nov 13, 2012 8:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
teeigeryuh
Master Cheater
Reputation: 25

Joined: 13 Oct 2008
Posts: 261
Location: The netherlands

PostPosted: Tue Nov 13, 2012 8:36 pm    Post subject: Reply with quote

so, ideas?
_________________

ლ(╹◡╹ლ)
Back to top
View user's profile Send private message
Up2Admin
I'm a spammer
Reputation: 126

Joined: 17 Oct 2007
Posts: 6549
Location: Texas

PostPosted: Tue Nov 13, 2012 8:55 pm    Post subject: Reply with quote

try figuring it out yourself first, use common debugging methods.
_________________
Back to top
View user's profile Send private message Visit poster's website
teeigeryuh
Master Cheater
Reputation: 25

Joined: 13 Oct 2008
Posts: 261
Location: The netherlands

PostPosted: Tue Nov 13, 2012 9:05 pm    Post subject: Reply with quote

Up2Admin wrote:
try figuring it out yourself first, use common debugging methods.


I know: none.

_________________

ლ(╹◡╹ლ)
Back to top
View user's profile Send private message
1929394839292057839194958
Grandmaster Cheater Supreme
Reputation: 130

Joined: 22 Dec 2006
Posts: 1509

PostPosted: Tue Nov 13, 2012 9:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cryoma
Member of the Year
Reputation: 198

Joined: 14 Jan 2009
Posts: 1819

PostPosted: Tue Nov 13, 2012 9:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Evil_Intentions
Expert Cheater
Reputation: 65

Joined: 07 Jan 2010
Posts: 214

PostPosted: Tue Nov 13, 2012 10:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
teeigeryuh
Master Cheater
Reputation: 25

Joined: 13 Oct 2008
Posts: 261
Location: The netherlands

PostPosted: Tue Nov 13, 2012 10:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
Evil_Intentions
Expert Cheater
Reputation: 65

Joined: 07 Jan 2010
Posts: 214

PostPosted: Tue Nov 13, 2012 10:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites