Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: wchill on April 01, 2010, 05:57:56 am

Title: DENCrypt v1.5 beta
Post by: wchill on April 01, 2010, 05:57:56 am
An encryption program I have decided to share with the world. (Loosely?)Based on the one-time pad.
This encryption is theoretically impossible to crack (IRL, it's just really really hard).
You can either use the program to generate your keys (DOES NOT USE RAND), create a program to rand-generate for you, or make your own keys with random.org or by hand (read readme for details).
Accepts up to a 998 dimension input (list or string). Strings can use alphanumeric characters and some symbols.

Yeah. If you really want to encrypt something on your calculator, here's your solution. I recommend 3000+ bytes free and a TI-83+ SE or better. You'll need more RAM if you're encrypting bigger stuff though.

Enjoy.
Title: Re: DENCrypt v1.5 beta
Post by: Galandros on April 01, 2010, 08:10:02 am
One time pad is really impossible to crack if you used a real random number and the pad is not compromised.

Well the computer power to brute force all possible random generators is unimaginable.
To achieve true random numbers as far we know, there is hardware than gives a random number by watching strange physics events that from our current knowledge are random.

To anyone willing to understand what one pad is, search in the wikipedia...
Title: Re: DENCrypt v1.5 beta
Post by: DJ Omnimaga on April 01, 2010, 08:59:20 am
mhmm Interesting, I should maybe give this a try to mess around
Title: Re: DENCrypt v1.5 beta
Post by: Raylin on April 01, 2010, 11:14:13 am
I can't really see what I would use this program for...
Any uses...?
Title: Re: DENCrypt v1.5 beta
Post by: DJ Omnimaga on April 01, 2010, 04:50:16 pm
Encryption?
Title: Re: DENCrypt v1.5 beta
Post by: wchill on April 01, 2010, 11:52:52 pm
Hey, encryption is encryption.
I can't think of any good ideas, but maybe you can.
Also, feel free to modify/redistribute/repackage as you wish.

If anyone has any idea on how to make List to String conversion faster, please tell me how! It's currently the slowest part of the encryption/decryption process.
Title: Re: DENCrypt v1.5 beta
Post by: meishe91 on April 02, 2010, 12:25:00 am
Well this a variation of code from my Map Converter (http://ourl.ca/4314) program but it should help some, hopefully.

Code: [Select]
" ?Str1
For(A,1,dim(L1
Str1+sub("_Q",L1(A)+1,1?Str1
End
sub(Str1,2,WH?Str1

I highly doubt you can use this though just because it only deals with a list with 1's and 0's in it and uses that to create what goes into the string. Hopefully this is a good example to base something off of? If you maybe post your list to string code we could possibly help. :)
Title: Re: DENCrypt v1.5 beta
Post by: wchill on April 02, 2010, 12:54:24 am
The conversion code goes something like this:
-Character set stored to Str0.
-Initialize Str1.
-For( loop through list elements.
-Perform modular arithmetic on list element.
-Place character in string using Str1+ sub(Str0, Ans, 1 -> Str1
-End For( loop.
-sub(Str1, 2, length(Str1)-1 -> Str1 (removes initial space stored to Str1)
Title: Re: DENCrypt v1.5 beta
Post by: meishe91 on April 02, 2010, 12:57:36 am
Well I think that is kinda how my code is set up. So without seeing the actual code I can't really help. Others might though.
Title: Re: DENCrypt v1.5 beta
Post by: wchill on April 02, 2010, 01:51:37 am
: " →Str1
:  For(I,1,C)
: ∟ENC(I
: While Ans>length(Str0
: Ans-length(Str0
: End
: Str1+sub(Str0,Ans,1→Str1
: Output(3,1,iPart(100I/C
: End
: sub(Str1,2,length(Str1)-1→Str1
Title: Re: DENCrypt v1.5 beta
Post by: meishe91 on April 02, 2010, 02:27:01 am
Well I don't see any optimizations or ways to make that shorter or faster. Someone else might though. Sorry.
Title: Re: DENCrypt v1.5 beta
Post by: Galandros on April 02, 2010, 07:10:42 am
I can't really see what I would use this program for...
Any uses...?
In reality few for calculators... But it has a educative component and fun for others. Also it can serve as TI-BASIC coding experience if you don't have a better idea.
Title: Re: DENCrypt v1.5 beta
Post by: mapar007 on April 02, 2010, 10:46:44 am
Quote
This encryption is theoretically impossible to crack (IRL, it's just really really hard).

One-time pads are impossible to break if you have a true source of randomness. (in practice: a sufficiently non-deterministic source)

Basically it does this: (Alice & Bob are the participants, Alice transmits to Bob)

[this is what I remember from reading Bruce Schneier's book 'Applied Cryptography']

Alice and Bob are both in possession of the random string R, of length n. (or both have a cryptographically secure RNG with identical seeds)
Alice wants to transmit message M (with length n) to Bob. She XORs every bit of M with the corresponding bit of R, and transmits the resulting ciphertext C to Bob. Bob, having received C, XORs every bit of C with the corresponding bit of R, thus recreating M. Then, both strings are discarded. (it's insecure to continue using them)

Eve, the eavesdropper, stands nowhere nearer to the solution, since R is completely (at least, in theory) random, and no part of R recurs systematically throughout the ciphertext. Impossible to break this scheme, but hard to implement, since the strings R must be distributed in advance to guarantee security.


EDIT: oops, I missed Galandros' post earlier... Sorry.
Title: Re: DENCrypt v1.5 beta
Post by: ztrumpet on April 02, 2010, 11:28:47 am
wchill, I think that's the fastest it will go.  Great code, though! ;D
Title: Re: DENCrypt v1.5 beta
Post by: Raylin on April 02, 2010, 11:31:47 am
What would happen if you expand this a little further?
Perhaps a password program?
Title: Re: DENCrypt v1.5 beta
Post by: wchill on April 04, 2010, 09:41:59 pm
That could work. But unfortunately this form of OTP on a calculator is a memory hog.
The memory usage works out to basically ~57 bytes per character while it's processing everything.
Using compression on the lists increases processing time and I don't want to make it a lot slower than it is right now.

Short password lists (or math formulas?) could work, as long as you can protect the program, encrypted data and key themselves.
If only there was some faster way to use the sub( command, eh?