If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
simple encryption system
30 posts
• Page 2 of 3 • 1, 2, 3
Re: simple encryption system
This string worked in Trog's code: "ÈåçêëèïîìÄÅÉæ"
These are all single byte characters in the 128-255 range AFAIK and that seems to work in your scheme.
[edit]posted around the same time as Tester[/edit]
These are all single byte characters in the 128-255 range AFAIK and that seems to work in your scheme.
[edit]posted around the same time as Tester[/edit]
- strangeChild
- Posts: 47
- Joined: Sat Apr 27, 2013 8:04 pm
Re: simple encryption system
If only 'simple' is needed ... AND dealing with multi Arrays ...
You might consider the 'Marshal file routine' using the Raw Binary setting.
Names will generally be readable ... but there is plenty of non-readable. Depends how much 'cover' you want.
You might consider the 'Marshal file routine' using the Raw Binary setting.
Names will generally be readable ... but there is plenty of non-readable. Depends how much 'cover' you want.
Last edited by RJHollins on Sat Nov 02, 2013 9:50 pm, edited 1 time in total.
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: simple encryption system
Hey Trog, love your little module, would you mind feeding my curiosity and explaining the Ruby code a bit?
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: simple encryption system
Hey... I almost understand this now..
The 127 thing isn't necessary if you have this code instead:
This will allow any value 0-255 but Trog's version produces more scrambled strings with low values of inputs.
His actually works with -128 to 127 on the start code.
The binary XOR is symmetrical
a ^ c = d -> d ^ c = a
Then the c part increments with each character by the cycle part but the decode is unaffected as it too increments the same way.
The 127 thing isn't necessary if you have this code instead:
- Code: Select all
bytes = @in_string.bytes.to_a
code = @code_key
bytes.map! do |byte|
byte = byte ^ code
code += @code_cycle
code -= 254 if code > 254
byte.chr
end
output 0, bytes.join('')
This will allow any value 0-255 but Trog's version produces more scrambled strings with low values of inputs.
His actually works with -128 to 127 on the start code.
The binary XOR is symmetrical
a ^ c = d -> d ^ c = a
Then the c part increments with each character by the cycle part but the decode is unaffected as it too increments the same way.
- strangeChild
- Posts: 47
- Joined: Sat Apr 27, 2013 8:04 pm
Re: simple encryption system
It looks that Trogs little fellow may wotk with my native letters too. Will do some more tests later.
@strangeChild - thanks for mod, will play with it too, when checking other languages.
@strangeChild - thanks for mod, will play with it too, when checking other languages.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: simple encryption system
tester wrote:@strangeChild - thanks for mod, will play with it too, when checking other languages.
It won't work on anything that his wouldn't work with... it just took away the restrictions on the keys.
But you wouldn't want to use 0,0 as that won't encrypt at all.
- strangeChild
- Posts: 47
- Joined: Sat Apr 27, 2013 8:04 pm
Re: simple encryption system
There may be one problem with "high-index" ASCII numbers, and it's also the reason that I used only 128-254 for the encryption values.
If the encryption value just happens to match the character code exactly, the result of the XOR will be zero - and the zero value is often used as an "end of string" flag - what are known as "null terminated" strings. So I chose the number ranges on purpose to avoid this from happening - though that is only guaranteed anyway for the 0-127 'standard' ASCII characters.
In my first attempt at the module, I found exactly that problem - occasionally the encrypted string was truncated by nulls - so there needs to be some safeguard against that.
Base64 would be nice to use, but it isn't included as part of the FS Ruby installation - we only have the "core" classes and methods. In fact, none of the "standard libraries" are included, except for 'Win32API'.
There was some work done before on extending the libraries, but it involved having to recompile a lot of the Ruby installation files from source. Now that VST exports are using a statically linked version of the Ruby virtual machine, those techniques may not even work any more - at least not for plugin exports.
If the encryption value just happens to match the character code exactly, the result of the XOR will be zero - and the zero value is often used as an "end of string" flag - what are known as "null terminated" strings. So I chose the number ranges on purpose to avoid this from happening - though that is only guaranteed anyway for the 0-127 'standard' ASCII characters.
In my first attempt at the module, I found exactly that problem - occasionally the encrypted string was truncated by nulls - so there needs to be some safeguard against that.
Base64 would be nice to use, but it isn't included as part of the FS Ruby installation - we only have the "core" classes and methods. In fact, none of the "standard libraries" are included, except for 'Win32API'.
There was some work done before on extending the libraries, but it involved having to recompile a lot of the Ruby installation files from source. Now that VST exports are using a statically linked version of the Ruby virtual machine, those techniques may not even work any more - at least not for plugin exports.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: simple encryption system
To summarize.
Trog - your module is working for ascii (which does not contains non-english letters), or for non-UTF ("half-size" if I can name it this way) codepages? Because it seems to work with polish letters (as well as FS itself).
And second question would be - this simple encoding system will work for al languages, that use such sort of "half size" codepages? I mean - will it work with everything that FS can handle via it's own stringish greenery?
Now, there is one more interesting thing. While language specific (polish) letters are not displayed correctly in string/text primitives (some sort of other strange characters instead) - they are displayed on labels and editboxes. The picture shows the output after encryption/decryption (input and output are match).
Trog - your module is working for ascii (which does not contains non-english letters), or for non-UTF ("half-size" if I can name it this way) codepages? Because it seems to work with polish letters (as well as FS itself).
And second question would be - this simple encoding system will work for al languages, that use such sort of "half size" codepages? I mean - will it work with everything that FS can handle via it's own stringish greenery?
Now, there is one more interesting thing. While language specific (polish) letters are not displayed correctly in string/text primitives (some sort of other strange characters instead) - they are displayed on labels and editboxes. The picture shows the output after encryption/decryption (input and output are match).
- Attachments
-
- disp.png (12.3 KiB) Viewed 12565 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: simple encryption system
It seems to work because you have happened to get lucky that the code key never exactly matched the value of the upper-ascii letter or it would encrypt to char(0) and terminate the string.tester wrote:it seems to work with polish letters
- strangeChild
- Posts: 47
- Joined: Sat Apr 27, 2013 8:04 pm
30 posts
• Page 2 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 57 guests