Computer Science Canada Encoder/Decoder w/ Numbers? |

Author: | tlivingston [ Mon Nov 25, 2002 11:20 pm ] |

Post subject: | Encoder/Decoder w/ Numbers? |

Heres the scenario. Im makin that rpg i talked about earlier and I have an option where the player can write to a file to "save" his/her game. The problem is that it saves as a tesxt file which can be EASILY hacked and so i want some sort of thing to encode the variables being saved (this is to ensure that when i make a stand alone program ppl will not cheat). The thing is, i've got strings figured out (quite easy to do) but how could i do it w/ numbers other than adding a certain number to the value? Any help appreciated. Ted |

Author: | FizixMan [ Tue Nov 26, 2002 1:03 am ] |

Post subject: | |

well... you could use a mathematical method of Matrix Encoding... but unless you've taken Grade 12 or OAC finite math... I doubt you know how to do it... plus, it might be a bit odd making the code, but I could probably do it for you... maybe... What if you apply a mathematical formula to it? Say 3X-20=Y when you encode it. Then to decode it it's just X=(Y+20)/3 Alternatively; maybe you can write an algorithm to convert the text to letters using the chr(X) function. So each number would output to the .txt by Y=chr(X), then reading it back in, you can use X=ord(Y). ord returns the number equivilent of the character. It's still possible someone could write a program to do that though... lol, if I did write that matrix encoding, I can almost guarantee you no one would break it (unless they manage to decode the .exe and found the encoding matrix) |

Author: | Tony [ Tue Nov 26, 2002 8:31 pm ] |
||

Post subject: | |||

lol, someone can reverse engeneer your exe and break your encription Otherwise, FizixMan is right. You use chr() and ord() to convert strings to ASCII values, then you can apply a math function to encript it. Furthermore you can add one(or more) checking values that suppost to mach sertain other values in the encripted number so that you can't just randomly change some values. such as in 123 12 is actual number and 3 is sum of all other digits. This way if you change it to 223, it is not valid. Here's the simpliest encription:
this just moves letters by +1 so A is now B and B is now C. |

Author: | p00p [ Fri May 07, 2004 8:00 am ] |

Post subject: | |

hm i dont know how to do that |

Author: | AsianSensation [ Fri May 07, 2004 9:38 am ] |

Post subject: | |

what? spam? locked? |

: |

You can syndicate this boards posts using the file backend.php or view the topic map using sitemap.php.