Posted 12 April 2016 - 10:55 PM
Hello, CC community!
I've just recently come back to writing programs for computercraft again and thought it would be a good idea to start off simple.
The API I've made is an object-based encryption algorithm, which works symmetrically, meaning, that you use one password to de- and encrypt. I know it is neither efficient, nor uncrackable (I know someone can do this.), but it works, and that's the main point. "Quod erat demonstrantum", as romans would say.
The API has 4 methods;
It can be downloaded via pastebin, but it needs another API to function; Stringmanager, also found below. Load both APIs via os.loadAPI() and you're good to go!
PS: Saving can be achieved by serializing the table. I have to streamline the whole thing a bit, a table isn't the best solution, honestly!
CryptX: http://pastebin.com/rNEUDtJf
StringManager: http://pastebin.com/U0GDqWzv
I've just recently come back to writing programs for computercraft again and thought it would be a good idea to start off simple.
The API I've made is an object-based encryption algorithm, which works symmetrically, meaning, that you use one password to de- and encrypt. I know it is neither efficient, nor uncrackable (I know someone can do this.), but it works, and that's the main point. "Quod erat demonstrantum", as romans would say.
The API has 4 methods;
--creates the object and sets an encryption password. The password is optional, as it can be set later with initialize()
function CryptX:craft( password )
--Initializes the seed and everything else to begin de/encryption
function CryptX:initialize( password )
--Encrypts a string and returns an encoded table.
function CryptX:encrypt( str )
--Decrypts the table created by encrypt() and returns the original string. Please note, that the password used for decryption must match the on used to encrypt the message.
function CryptX:decrypt( tEncr )
It can be downloaded via pastebin, but it needs another API to function; Stringmanager, also found below. Load both APIs via os.loadAPI() and you're good to go!
PS: Saving can be achieved by serializing the table. I have to streamline the whole thing a bit, a table isn't the best solution, honestly!
CryptX: http://pastebin.com/rNEUDtJf
StringManager: http://pastebin.com/U0GDqWzv