simple encryption system

For general discussion related FlowStone
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

simple encryption system

Post by tester »

I'm looking for a simple encryption system for text data (letters, numbers, other characters, newline marks). I just need to convert some sort of "preset/project file" (i.e. text file, not used by preset manager - just loaded externally) into something not readable, and then back again. The only goal is to prevent user from accidental visual access to the content within that text file. Encrypted - would be meaningless enough.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: simple encryption system

Post by Tronic »

base64, with some remix of string, should be good?
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: simple encryption system

Post by tester »

Anything that works correctly when converting back and forth, anything that makes the text meaningless if you open the text file, anything that works fast. Project files are small, few kB.

It should work correctly with multi-line texts; I noticed in some earlier posts, that there are some confusions on "end line" markings, depending on OS (and system settings?). The project itself uses green prims and ruby modules, so it could cause some problems.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: simple encryption system

Post by Tronic »

the base 64, is not os dipendant.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: simple encryption system

Post by tester »

If it's os independent, then it should be fine. As I mentioned - there is no big requirement for this encryption part.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: simple encryption system

Post by trogluddite »

The CIA or a good hacker could crack this in a few minutes, but if you just want to obfuscate things enough to deter a casual onlooker, here's a quick encrypt/decrypt module...
Simple Encoder.fsm
(1.53 KiB) Downloaded 1065 times

Note that I haven't tested this when saving/loading the files, but values stay within the 8-bit ASCII range, so there shouldn't be a problem.
It also assumes that all input characters are "standard" ASCII - i.e. with codes within the 0-127 range, and no special "extended" characters. Again, that should be fine for regular text strings and numerals.
Encoding and decoding use exactly the same module with matching code key integers.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: simple encryption system

Post by tester »

I use only letters (but will it work with non-english letters? we have a lot of ą, ę, ś, ż, and others, but different hanguages may have their own too), numbers, and some characters as a separators (,/\^| and few others).
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: simple encryption system

Post by trogluddite »

All of the separator characters should be OK, but at the moment, it won't work for non-english characters as they are outside the ASCII range.
Having said that, I'm not sure even how regular "green" strings would handle non-ASCII characters - it requires support for Unicode ("UTF"), which allows character codes longer than one byte. Ruby does have support for UTF, but whether it would interface well with "green", I do not know. The default encoding in Ruby is definitely just ASCII - presumably for compatibility with green strings.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: simple encryption system

Post by Tronic »

the title is simple encryption system, and the base64 + mixin-string has all you need.
and support also the Unicode Char.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: simple encryption system

Post by tester »

trogluddite wrote:All of the separator characters should be OK, but at the moment, it won't work for non-english characters as they are outside the ASCII range.
Having said that, I'm not sure even how regular "green" strings would handle non-ASCII characters - it requires support for Unicode ("UTF"), which allows character codes longer than one byte. Ruby does have support for UTF, but whether it would interface well with "green", I do not know. The default encoding in Ruby is definitely just ASCII - presumably for compatibility with green strings.


@Trog. To my surprise - both, green processing and ruby seem to work fine with our characters (it's based on Central European, either Windows 1250 or ISO-8859-2 coding). I'm using external text files, and have all language specific letters. But display may depend on operating system (enabled encodings). So it seems to be "pass through" situation.

@Tronic. Okay, where can i find it?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply