Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Encrypting
Index -> Programming, Turing -> Turing Help
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TokenHerbz




PostPosted: Thu Mar 02, 2006 6:59 pm   Post subject: Encrypting

How would you go about encrypting a save file for your pogram...

Say you got a user name and password, or RPG info, and save it to a file called... Save.txt

what do you do to get both numbers and letters jumbuled so the user can't read it... Also, to unencript it so it is readable....


Also, say you have 2 turing files.. a Main.t and a Data.t

in the main.t file you include data.t which holds say, var t: string := "Talk"

main file says, put t (this is just for an example)

You turn Main.t into .exe so how do you stop users from accessing data.t
Sponsor
Sponsor
Sponsor
sponsor
Martin




PostPosted: Thu Mar 02, 2006 7:21 pm   Post subject: (No subject)

Well, the easiest you could do would be to just add n to each letter.

a -> c
b -> d
c -> e
...
etc.

Or maybe, add 2 * the index in the string.
For the password 'abcd', you would get
a -> c (a + 2*1)
b -> f (b + 2*2)
c -> i (c + 2*3)
d -> l (d + 2*4)

Basically, you can use any obfuscation that is reversible.

Or if you want, you could look into using seeded random numbers - this way you just add a random amount to each letter, but you can figure out what those random amounts were later.

The pros use http://en.wikipedia.org/wiki/RSA , but that could be overkill
md




PostPosted: Thu Mar 02, 2006 7:48 pm   Post subject: (No subject)

don't forget xor encryption; or base64 encoding. Both are simple and useful for obfuscation. Really unless your using something more complex then substitution and different bases all your doing is obsucation rather then encrypting.

If you're really adventurous though you could try your hand at porting Blowfish to turing Wink
TokenHerbz




PostPosted: Thu Mar 02, 2006 7:54 pm   Post subject: (No subject)

Lamer... your suggetion
a -> c (a + 2*1)
b -> f (b + 2*2)
c -> i (c + 2*3)
d -> l (d + 2*4)

what happends in the word iglooze, where z is the last letter, and cannot grow? Im thinking it will be alot of code to get the z to subtarct yes?

Im looking for an effective, easy, and fast way to encripy both numbers and letters...
Andy




PostPosted: Thu Mar 02, 2006 8:03 pm   Post subject: (No subject)

err of course z works.. z + 2*26 == z
MysticVegeta




PostPosted: Thu Mar 02, 2006 8:09 pm   Post subject: (No subject)

Cornflake wrote:
don't forget xor encryption; or base64 encoding. Both are simple and useful for obfuscation.
eh, I doubt the information hes storing inside the file will be "that" important/confidential. lol.
Delos




PostPosted: Thu Mar 02, 2006 8:16 pm   Post subject: (No subject)

TokenHerbz wrote:
Lamer... your suggetion...


Actually, his name is Martin. His title is Lamer. Look again...Very Happy
TokenHerbz




PostPosted: Thu Mar 02, 2006 8:43 pm   Post subject: (No subject)

lol oh yeah, lamer just stood out and stuck in my head....

Um, I will attempt to try the encryption...
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Thu Mar 02, 2006 9:32 pm   Post subject: (No subject)

TokenHerbz, there are characters with ASCII values higher than z. After that, it would be: ... x, y, z, {, |, } ...
TokenHerbz




PostPosted: Thu Mar 02, 2006 9:40 pm   Post subject: (No subject)

Ok here is my test code which seems to work, any ideas to improve will help alot, but im thinking of puting the encryption into a proceadure and call it with EACH variable, cause i dont know how else to make this effective for 50 variables.... Any ideas?

code:

%%encrypting test
setscreen ("Graphics:200;200")

var test_File : int
var word : string := "thiss"
var newword : string := ""
var num : int := 23
var newnum: string
var letter : string

proc save
    %%code strings
    for i : 1 .. length (word)
        newword += chr (ord (word (i)) + 5)
    end for
    put newword
    %%code numbers
    newnum := chr (num)
    put newnum
    %%save it into file
    open : test_File, "Test1.txt", put
    put : test_File, newword, " ", newnum
    close : test_File
end save

save

proc load
    %%gets the strings from file
    open : test_File, "Test1.txt", get
    get : test_File, newword, newnum
    close : test_File
    %%uncodes strings
    word := ""
    for i: 1 .. length(newword)
        word += chr (ord (newword (i)) - 5)
    end for
    %%uncodes the numbers
    num := ord (newnum)
end load

load
put num
put word


%%look in the file... to see it work...
TokenHerbz




PostPosted: Fri Mar 03, 2006 12:25 am   Post subject: (No subject)

Alright, lets say i have a basic encryption...


I wish to make a brief case to which i can *hide* files in, where you need a password to access it... lets say i want to put some good old .exe's and movies of sorts, perhaps pics too...

Is turing able to act like a folder?? with a password ability?? I would like some help on this, as i have not learned anything on this yet...
TokenHerbz




PostPosted: Fri Mar 03, 2006 12:28 am   Post subject: (No subject)

Edit:: i cant find the edit button

I forgot to mention...

if it can hold and secure files, can it block searches aswell, saying acees is needed, or better yet, not being able to detect it on the comp?
[Gandalf]




PostPosted: Fri Mar 03, 2006 12:33 am   Post subject: (No subject)

The edit button was removed some time ago.

Basically, the answer to all those questions is no. You would probably need access to the Windows API for all those things, which Turing doesn't have. The only thing you can do is encrypt/obfusciate the files in those folders.
TokenHerbz




PostPosted: Fri Mar 03, 2006 2:42 am   Post subject: (No subject)

Can anyone help me creat an effective encrytion code?

I want to lots of info into here, threw serveral variables of all types...

Booleans / Ints / strings :etc:

and i cant encrypt each variable at a time...
codemage




PostPosted: Fri Mar 03, 2006 8:57 am   Post subject: (No subject)

I'm surprised that nobody has mentioned changing the file postfix.

If your data file is named *.txt, you're just begging someone to start editing values & seeing what happens.

If you rename it to a non-editable type (it's ok to lie with filenames) like .dll or .ifo or .sys, you'll scare off 90% of would-be hackers.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 3  [ 40 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: