
-----------------------------------
Geniis
Mon Nov 16, 2009 9:11 pm

Encryption module
-----------------------------------
This is just a simple little module i coded named Crypto that can encrypt and decrypt files. Its easy to use, its explained in the readme. Just use Crypto.EncriptFile to encrypt a file and Crypto.DecryptFile to decrypt a file (i recommend only decrypting files encrypted with Crypto). There is also a way to change the keys used. Leave feed back if you fell like it, or if you find bugs... i might release a better version of it later on.

-----------------------------------
SNIPERDUDE
Tue Nov 17, 2009 1:25 pm

RE:Encryption module
-----------------------------------
Great job

+ bits

-----------------------------------
mirhagk
Tue Dec 15, 2009 12:03 am

Re: Encryption module
-----------------------------------
This reminded me of an earlier encryption program I created, it uses a key, and you can create keys for it (that way even if someone has the program they can't do very much cuz need the exact key)

-----------------------------------
yazdmich
Thu Dec 06, 2012 10:04 am

Re: Encryption module
-----------------------------------
This reminded me of an earlier encryption program I created, it uses a key, and you can create keys for it (that way even if someone has the program they can't do very much cuz need the exact key)

I edited your program as a module and added a few features.

-----------------------------------
mirhagk
Thu Dec 06, 2012 5:46 pm

RE:Encryption module
-----------------------------------
Ahh code from my very early days of Turing, it makes me realize just how much I've learned over the past 3 years.

I'd suggest allowing the programmer pass in file names in the module's functions, so that it can truly be used as a module. I would then suggest using a better encryption algorithm, a one time pad would actually be pretty good for this scenario, is easy to implement, and is actually the most secure algorithm (so long as it's used right)

-----------------------------------
yazdmich
Thu Dec 06, 2012 6:32 pm

Re: RE:Encryption module
-----------------------------------
Ahh code from my very early days of Turing, it makes me realize just how much I've learned over the past 3 years.

I'd suggest allowing the programmer pass in file names in the module's functions, so that it can truly be used as a module. I would then suggest using a better encryption algorithm, a one time pad would actually be pretty good for this scenario, is easy to implement, and is actually the most secure algorithm (so long as it's used right)

2 things:

I thought I did allow for variable pass-through?

I'm actually relatively new to Turing (and programming in general) so I'm not quite sure how to implement a one-time pad cipher


% KEY-BASED ENCRYPTION MODULE BASED ON http://compsci.ca/v3/download.php?id=7033
% MODIFIED AS A MODULE WITH KEY GENERATOR INCLUDED IN MAIN CODE


unit
module Crypto

    export GetKey, In, Out, key, GenKey, Decoded, Encoded

    var ind : int
    var key := ""
    var encode := ""
    var msg : string
    var msgout : string
    var Encoded := ""
    var Decoded := ""
    var stream : int
    var num : int
    var cha : string (1)
    var name : string
    var alphas := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz,.?\"'()

-----------------------------------
mirhagk
Thu Dec 06, 2012 11:54 pm

RE:Encryption module
-----------------------------------
Ah I only really looked at the GenKey method, the only one where variables aren't passed through lol.

A one time pad basically generates a really large list of random characters, and uses this as the key (the key must be as long as the message in order to be perfectly secure).

You can then go through and use some method to encrypt the message in such a way that you can reverse it. A very common method is to use the XOR operator, which basically works by comparing the bits of each number and puts a 1 every time they are different, and 0 every time they are the same, eg:
110001 message
101010 key
=====
011011 result
Then you can XOR the result with one of the values to get the other one:
011011 result
101010 key
=====
110001 message

-----------------------------------
yazdmich
Fri Dec 07, 2012 9:03 am

Re: RE:Encryption module
-----------------------------------
A one time pad basically generates a really large list of random characters, and uses this as the key (the key must be as long as the message in order to be perfectly secure).
I'm guessing 255 chars long would be best, so that any line passed through can be encrypted. Also, should it be completely random (with repeated characters)?

-----------------------------------
AntoxicatedDevil78
Fri Dec 07, 2012 10:29 am

RE:Encryption module
-----------------------------------
Amazing!! :)

-----------------------------------
mirhagk
Fri Dec 07, 2012 12:18 pm

RE:Encryption module
-----------------------------------
Yep completely random is best. So long as you use the exact same key it will decrypt and encrypt fine. Technically you should have perfect randomness (random in turing isn't fully random), but the concept is the same.

-----------------------------------
yazdmich
Fri Dec 07, 2012 1:50 pm

Re: RE:Encryption module
-----------------------------------
Is this good for the key generator?


    var ind : int
    var key : string := ""
    var encode := ""
    var msg : string
    var msgout : string
    var Encoded := ""
    var Decoded := ""
    var stream : int
    var num : int
    var name : string
    var alphas := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz,.?\"'()

-----------------------------------
mirhagk
Fri Dec 07, 2012 2:56 pm

RE:Encryption module
-----------------------------------
Yeah that will generate a long enough key (again it's not perfectly secure, but you can't make it perfect without true random numbers).

Just curious, is there any reason for using cha instead of just using alphas?
