Jump to content




encryption


  • You cannot reply to this topic
12 replies to this topic

#1 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 01 October 2012 - 06:55 PM

i saw some encryption programs for lua on lua-users.org but they all require external C libraries. and i dont think CC can load those guys.
so if anyone has an encryption and decryption api ready or know one (with passwords) then i would like to use it!

thx in advance :)/>
wilcomega

#2 GopherAtl

  • Members
  • 888 posts

Posted 01 October 2012 - 07:12 PM

tomas1996's StringUtils includes some password-based encryption/decryption I think? It' a bit outdated now - some of it's functions are in the native stringutils library, and it's lua-based bitwise operations ought to be removed and the algos written to use the java-based ones in the new java-based bitwise api for cc 1.42+, but it's still usable as-is I assume. Not tried the encryption, only used the SHA1 function, but it worked well enough.

Link to his thread here http://www.computerc...ring-utils-api/

#3 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 01 October 2012 - 08:04 PM

What would be the application of this encryption? If it's simple, like a keycard system, you can use math.randomseed() to do a little jiggery... I'll come up with something a little easier to look at than just ideas soon...

#4 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 01 October 2012 - 08:38 PM

Strike that...I know nothing of what I am talking about..... Using math.randomseed() is super difficult to implement. Using someone else's pseudo-random number generator is not really a good idea.

#5 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 01 October 2012 - 10:18 PM

Found a way: Hz5zR22t

#6 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 01 October 2012 - 10:29 PM

View Postjag_e_nummer_ett, on 01 October 2012 - 10:18 PM, said:

Found a way: Hz5zR22t
Well, it would be better to use a simple xor encryption:
local function xorEncrypt(data, key)
    local klen = #key
    local s = ""
    for i = 1, #data do
        s = s..string.char(bit.bxor(string.byte(data, i), string.byte(key, i % klen)))
    end
    return s
end
The same function works to encrypt and decrypt.

#7 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 01 October 2012 - 10:32 PM

That's more of a cipher than a true encryption... isn't it?

#8 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 01 October 2012 - 10:33 PM

View PostCranium, on 01 October 2012 - 10:32 PM, said:

That's more of a cipher than a true encryption... isn't it?
Cipher = program that encrypts. :)/>
It's not a good algorithm and it's easy to break, but should be enough for most CC uses.

#9 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 01 October 2012 - 10:41 PM

Meh, I suppose.
Gonna try to implement this into some sort of keycard system.

#10 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 01 October 2012 - 11:13 PM

i made a super secure one here

#11 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 01 October 2012 - 11:40 PM

View PostMysticT, on 01 October 2012 - 10:29 PM, said:

View Postjag_e_nummer_ett, on 01 October 2012 - 10:18 PM, said:

Found a way: Hz5zR22t
Well, it would be better to use a simple xor encryption:
local function xorEncrypt(data, key)
	local klen = #key
	local s = ""
	for i = 1, #data do
		s = s..string.char(bit.bxor(string.byte(data, i), string.byte(key, i % klen)))
	end
	return s
end
The same function works to encrypt and decrypt.
Well, I don't know anything about encrypting, I just fount that on the interwebs

#12 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 01 October 2012 - 11:48 PM

View Postjag_e_nummer_ett, on 01 October 2012 - 11:40 PM, said:

Well, I don't know anything about encrypting, I just fount that on the interwebs
Hooray for Google!!!

#13 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 01 October 2012 - 11:51 PM

View PostCranium, on 01 October 2012 - 11:48 PM, said:

Hooray for Google!!!
Google is your friend! (Not Yahoo or Bing!!)
:)/>





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users