Jump to content




working password based encryption


28 replies to this topic

#1 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 09 September 2012 - 10:47 PM

a basic encryption program for you lazy people

can encrypt: tables,strings,boolean,numbers,functions
update history:
Spoiler


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:
Spoiler

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

#2 Xtansia

  • Members
  • 492 posts
  • LocationNew Zealand

Posted 10 September 2012 - 12: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.

#3 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 11 September 2012 - 03:11 PM

sorry, forgot to update it with the code in np++, sould work now

#4 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 21 September 2012 - 12:44 AM

no responses? "works fine" is good enough

#5 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 21 September 2012 - 04:37 PM

I haven't had a need to encrypt anything, but if I do, I'll take a look at this here.

#6 GopherAtl

  • Members
  • 888 posts

Posted 21 September 2012 - 11:19 PM

pastebin version would be nice, and I'd try it out.

#7 robhol

  • Members
  • 182 posts

Posted 26 September 2012 - 06:06 AM

What algorithm is this? I have a pure lua Arcfour implementation that I found on the net, might be useful.

#8 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 29 September 2012 - 04: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.

#9 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 01 October 2012 - 11:26 PM

The code is still wrong, the error tomass said is not fixed.
You should test your code before posting it.

#10 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 02 October 2012 - 02:33 AM

View PostMysticT, on 01 October 2012 - 11:26 PM, said:

The code is still wrong, the error tomass said is not fixed.
You should test your code before posting it.
yes it does:
Posted Image

#11 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 03 October 2012 - 01: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.

#12 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 03 October 2012 - 01:42 AM

View PostMysticT, on 03 October 2012 - 01:02 AM, said:

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:
Posted Image

#13 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 03 October 2012 - 01: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.

#14 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 11 October 2012 - 09: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

#15 robhol

  • Members
  • 182 posts

Posted 12 October 2012 - 06:33 AM

Being a game, it's not all that important, but homebrewed encryption algorithms are usually not a tremendously great idea. :P/>

#16 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 13 October 2012 - 05:56 AM

View Postrobhol, on 12 October 2012 - 06:33 AM, said:

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

#17 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 14 October 2012 - 07:01 AM

updated to 1.2
added some checksum stuffs, and a tutorial on how to make your login script secure :)/>

#18 cheekycharlie101

  • Members
  • 231 posts

Posted 16 October 2012 - 06: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

#19 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 16 October 2012 - 06:48 PM

View Postcheekycharlie101, on 16 October 2012 - 06:13 PM, said:

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

#20 Sirharry0077

  • Members
  • 23 posts

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users