This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
PixelToast's profile picture

working password based encryption

Started by PixelToast, 09 September 2012 - 09:47 PM
PixelToast #1
Posted 09 September 2012 - 11:47 PM
a basic encryption program for you lazy people

can encrypt: tables,strings,boolean,numbers,functions
update history:
Spoiler—1.0—
initial release

—1.1—
security update
found a huge hole in unserialization allowing functions to be run

—1.2—
security update
added more options to the checksum function, allowing for more secure password checking


usage:

encrypt(data,password)
decrypt(data,password) -- on error returns data,decoded,decoded checksum
checksum(string[,detail]) -- default for detail is 1
a really good way to use the checksum function is to store a checksum instead of a password, so you cant just open up a file to see a password
example:
Spoiler40281018 is the result of checksum("password",1000)

shell.run("clear")
write("Pass: ")
input=read()
if enc.checksum(input,1000)==40281018 then
	print("Access granted.")
else
	print("Access denied.")
end
when the access is granted you can use the input to decrypt personal info :3

all of the functions besided the ones listed above are part of my unreleased api so i just copied them in
pastebin: http://pastebin.com/WRTfH0yx

how to use:
Spoiler

edit, use, redistribute but give credit
Xtansia #2
Posted 10 September 2012 - 01:59 AM
Doesn't work: abc_enc.lua:106: wrong number of arguments to 'insert'
table.insert(out,key[cnt][1],zfill(wrap(string.byte(char)+key[cnt][2])),chars)
Also the char variable there doesn't exist.
PixelToast #3
Posted 11 September 2012 - 04:11 PM
sorry, forgot to update it with the code in np++, sould work now
PixelToast #4
Posted 21 September 2012 - 01:44 AM
no responses? "works fine" is good enough
Cranium #5
Posted 21 September 2012 - 05:37 PM
I haven't had a need to encrypt anything, but if I do, I'll take a look at this here.
GopherAtl #6
Posted 22 September 2012 - 12:19 AM
pastebin version would be nice, and I'd try it out.
robhol #7
Posted 26 September 2012 - 07:06 AM
What algorithm is this? I have a pure lua Arcfour implementation that I found on the net, might be useful.
PixelToast #8
Posted 29 September 2012 - 05:41 PM
i made it up by my self, basically it uses the bytes of the password as a random seed to add to the encoded outputs bytes and also shifts the characters around randomly, making it 10000x harder to brute force without the original program.
MysticT #9
Posted 02 October 2012 - 12:26 AM
The code is still wrong, the error tomass said is not fixed.
You should test your code before posting it.
PixelToast #10
Posted 02 October 2012 - 03:33 AM
The code is still wrong, the error tomass said is not fixed.
You should test your code before posting it.
yes it does:
MysticT #11
Posted 03 October 2012 - 02:02 AM
Well, the line is still wrong:

table.insert(out,key[cnt][1],zfill(wrap(string.byte(char)+key[cnt][2])),chars)
there's 4 arguments to the method, but it only takes 3. I wasn't testing in CC, it seems to ignore the extra argument there.
PixelToast #12
Posted 03 October 2012 - 02:42 AM
Well, the line is still wrong:

table.insert(out,key[cnt][1],zfill(wrap(string.byte(char)+key[cnt][2])),chars)
there's 4 arguments to the method, but it only takes 3. I wasn't testing in CC, it seems to ignore the extra argument there.
you must be using the one i posted before, not the one i uploaded to pastebin
line 106:
MysticT #13
Posted 03 October 2012 - 02:47 AM
No, it's the one on pastebin. Line 114:

table.insert(out,key[cnt][1],zfill(wrap(string.byte(char)+key[cnt][2])),chars)
The ",chars" shouldn't be there.
But it works anyway, so no problem.
PixelToast #14
Posted 11 October 2012 - 10:36 PM
updated to 1.1, fixed some holes in unserialization allowing functions to be run, now you can feel completely safe when decoding rednet messages

also i uploaded the pastebin with an account so i dont have to keep updating the link
robhol #15
Posted 12 October 2012 - 07:33 AM
Being a game, it's not all that important, but homebrewed encryption algorithms are usually not a tremendously great idea. :P/>/>
PixelToast #16
Posted 13 October 2012 - 06:56 AM
Being a game, it's not all that important, but homebrewed encryption algorithms are usually not a tremendously great idea. :)/>/>
actually with le hackcraft server all rednet messages are broadcasted so its pretty usefull

meh, its simpler than recoding a complex. popular encryption method :)/>/>
trust me, its safe and almost impossible to brute force
*starts working on a brute force program*'

but if you want it to be super secure you can store a random 256 char password on a floppy making it take literaly centurys to decode, while creating millions of false positives :3

EDIT:
made it, but it takes like 30 min just to hack a 6 char password 0_0
PixelToast #17
Posted 14 October 2012 - 08:01 AM
updated to 1.2
added some checksum stuffs, and a tutorial on how to make your login script secure :)/>/>
cheekycharlie101 #18
Posted 16 October 2012 - 07:13 PM
Great code, just one tip. note i havn't read the pastebin version. but dont use shell.run("clear"). you want to avoid adding programs. instead use term.clear() this is a function in the built in api's of CC. just a tip
thanks -Cheeky
PixelToast #19
Posted 16 October 2012 - 07:48 PM
Great code, just one tip. note i havn't read the pastebin version. but dont use shell.run("clear"). you want to avoid adding programs. instead use term.clear() this is a function in the built in api's of CC. just a tip
thanks -Cheeky
yea, i know, i made a virus reinfect itself using programs that use shell.run

its an api so there is no point in clearing the screen
Sirharry0077 #20
Posted 11 February 2013 - 04:26 AM
This program is great. I will be implementing it in my program. I will give credit, of course.
anonimo182 #21
Posted 11 February 2013 - 05:59 AM
This program is great. I will be implementing it in my program. I will give credit, of course.
So there goes another topic revived…
deleted #22
Posted 25 May 2013 - 11:36 AM
You should add another thing to the encrypt function like for the salt
basdxz #23
Posted 12 August 2013 - 11:09 AM
How do I store the encrypted data? I mean I don't really get what to do with the number and string thing I get when I encrypt something. Storing as a string does not work.
Derpy me :P/>. Anyways nice API works well :D/>.
PixelToast #24
Posted 14 August 2013 - 10:40 AM
would suggest you not use this, i made a little cracker in normal lua that would crack the "hashes" in a matter of seconds
RoD #25
Posted 19 May 2014 - 10:41 PM
a basic encryption program for you lazy people

I am not lazy :(/> i just dont have the knowledge to develop a thing like this (you can say that not searching is lazyness, but i do search, slowly learning but getting further)

Anyways as i said, i cant make an encryption API, but i needed one to make a server-client API and i really like your's. Is that ok if i copy your code and paste in my code? (i have a comment giving you credits)

PS: i read that you allow us to share by giving you credit, but i dont want to use it as an api, but implementing it in a single code. (if i am making myself clear)

Thanks
Zudo #26
Posted 20 May 2014 - 05:18 PM
a basic encryption program for you lazy people

I am not lazy :(/> i just dont have the knowledge to develop a thing like this (you can say that not searching is lazyness, but i do search, slowly learning but getting further)

Anyways as i said, i cant make an encryption API, but i needed one to make a server-client API and i really like your's. Is that ok if i copy your code and paste in my code? (i have a comment giving you credits)

PS: i read that you allow us to share by giving you credit, but i dont want to use it as an api, but implementing it in a single code. (if i am making myself clear)

Thanks

Y U Necro… :D/>
apemanzilla #27
Posted 20 May 2014 - 05:32 PM
A two year necro, is that a record? XD
Zudo #28
Posted 20 May 2014 - 05:39 PM
A two year necro, is that a record? XD

The previous post was August 2013 :D/>
apemanzilla #29
Posted 20 May 2014 - 08:08 PM
A two year necro, is that a record? XD

The previous post was August 2013 :D/>
Nvm, I dun derped… Read 2012…