(note the "UNHACKABLE"ness is theoretical, read the very bottom spoiler for an explanation in to why it's unhackable)
Let's get the big question out of the way first: what makes this unique.
This program encrypts files in a way that I believe no human could easily decrypt, but (here's the killer) it does it without the use of any randomness; every "randomly" generated is based upon the password, this means that instead of storing the password somewhere in order to encrypt/un-encrypt the file the file is encrypted/un-encrypted USING the password.
Now you may be thinking "what if I enter the wrong password, does it just un-encrypt it all messed up?", the answer is no. I could tell you why not, but that would be spoiling it :)/>/>, there is a password check, just an encrypted one, and the password it's self is never checked.
At NO point in the encryption process is the password saved ANYWHERE, only the result of it's encryption.
Now lets get on to it's usage, you simply run the program then follow the on-screen instructions (enter file dir, password and whether you are opening or closing (un-encrypting or encrypting) a file
Well, that's it… here's the program:
Spoiler
http://pastebin.com/PjzXxXSBNote: you can use any of the following characters in the file you wish to encrypt:
pqowieurytlaksjdhfgmznxbcvPLOKIJUHYGTFRDESWAQMNBVCXZ|./,?><#';[]~@:{}=+-_0)9(8*7&6^5%4$3£21! ¬"
just so you know. (case sensitive)Any characters in a file will not be unencrypted back to what they were, all characters out of this range will be the same, but what the same is will be dependent on your password (and other factors)
example of encryption before/after:
Spoiler
before:Spoiler
£23
Hello my name is billy
this is ENCRYPTED
lalala :P/>/>
"HELLO"
'lol'
¬testing¬
£23
Spoiler
jvhklsPu
atyawehn
BsndztTvhskaKtYvltFdntMvmskajtDvltDdjtTvcscd
mtWvgsKdueIvLskaXt-v[s/dQt|vXs,dCt
TvvsPdntTvvska(t|v
stCdXtvSsQdte
$vcsgdzt$v
atjamtJvLsvdjtBvUssaye
bnuttape
Password?
never your mind!
The super boring maths behind it:
Spoiler
This just explains what the program does with each character when it deciphers it, it might ruin the magic for some.there is a string, defined as alpha, containing all characters on my QWERTY keyboard (without using alt).
the program first gets the number that the character appears at in the alpha
it then uses the index of the character on it's string to get a "random" letter from the password, by doing index - length of password until index < password
It then gets the character at this index of password and get's IT'S number, this is the modifier.
the random number is the character number added to the modifier ®.
if r is greater than the length of alpha then r is = to r - length of alpha and mod is equal to mod - a random number of pass, using my password encrypted random character generator, if this makes it less than one then you add r, if this makes it equal to what it originally was then you - 1, if it is greater than the length of alpha then it equals the length of alpha - 1.
The program then gets two characters from r and mod and places them in the string.
And that's the boring maths, this is it in code form:
local i = index
--make the index "valid"
while i > string.len(pass) do
i = i - string.len(pass)
end
--define "mod" using the index
local mod = getNum(string.sub(pass, i, i))
--define "n" using the character
local n = getNum(ch)
--define "r" using n + mod
local r = n + mod
local omd = mod
if r > string.len(alpha) then
r = r - string.len(alpha)
--mod madness!
omd = mod - getRand(pass)
while omd < 1 do omd = omd + r end
if omd == mod then omd = omd - 1 end
if omd > string.len(alpha) then omd = string.len(alpha)-1 end
end
--use r and mod to create a double character representing the original character!
return getCh(r)..getCh(omd)
Why this is theoretically impossible to hack:
Spoiler
also, on a side note, without a decoder and the password this is basically impossible to hack, there is a way to get just part of the password but this will not be reliable, this could be just two letters of the password or the whole thing. There is no way to brute force this; there is no string limit so theoretically the possible character combinations that make up the password are infinite. Anything encrypted with this program is, essentially, utterly secure. Unless someone get's hold of your password.Even someone like me, with complete understanding of the code, could not try and hack someone Else's program because I haven't preset any values to generate the encrypted file with (other than alpha).