The Lektor

BlitzMax Forums/BlitzMax Beginners Area/The Lektor

dw817(Posted 2016) [#1]
SOLUTION FOUND - SEE BELOW



I was just informed it is NOT a good idea to use SeedRnd() to encode and decode. I looked at my code below carefully and see I am only using it generated from a string of KEY.

If I can build a random sequence from a string without using RAND(), RND(), or RndSeed() (the encryption table), then it should be a viable alternative.


From the world of James Bond, the Lektor Decoder was a highly sought-after decoding machine, used by Soviet Intelligence to de-compile coded and highly sensitive documents.

The Lektor was the same size as a typewriter; the unit was in a brown leather case. Inside it contained small buttons, a coded data strip was inserted into a slot, and out of another slot came the decoded message on a strip of paper.

Encryption and decryption has always been needed for sensitive documents and to protect files, especially if they were uploaded on the Internet.

Here is my code for encryption. I think it's pretty good for encryption and decryption. But could it be better ?

So my question is, is there a better (and possibly smaller) 6-bit encryptor and decryptor source out there for BlitzMAX - one that encrypts VERY WELL ? Or do you think you could write one ?

I've seen many 8-bit encryptors using the classic XOR method, but no 6-bit to my knowledge which is the one desired here.





Failing a submit of source I am more than happy to use the one I wrote above as it appears to encrypt nicely enough for what I need.


Brucey(Posted 2016) [#2]
Or do you think you could write one ?

If it is for serious encryption, I'd always opt for proper, reasonably secure, already available algorithms. And probably just use an existing library, like libcrypto. (eg, https://github.com/maxmods/bah.mod/blob/master/crypto.mod/examples/cipher.bmx )

If it is just some toy plaything, then sure, write your own :-)


Floyd(Posted 2016) [#3]
Ditto. For fun do whatever you want, otherwise use a serious alternative.

The degree of randomness of Rand() is a phony issue. The Lektor was a thinly disguised version of the now famous Enigma. Even the earliest, simplest 1925 version had about 10^15 possible rotor arrangements, i.e. "keys". Your key is a single 32-bit integer. There are about four billion of those.

That makes a ninety year old device hundreds of thousands of times harder to break than your method, not matter what that method is. The 32-bit key already means it is not at all secure.


dw817(Posted 2016) [#4]
Floyd, how about this one ?

http://www.blitzbasic.com/Community/post.php?topic=105767&post=1293912

And no, I'm not going to use Rand() or anything like it. Not because there is the fear it could be cracked, no, I would be concerned about running my EXE on a different version of Windows or console were it permitted and to find =My= seeded randoms are not the same as they receive.

Currently my encryption uses math and XOR only. And, as I told Brucey, I think it's a pretty solid encryptor. I have a challenge, really for anyone, to decipher this:

http://www.blitzbasic.com/Community/post.php?topic=105767&post=1293970

All silliness aside, how would someone go about breaking the code for this to reveal the mystery sentence inside ?

arBGwZuu9pVkWok.IRrSdSI2w5N1de8bKcdfKNMD4Kqj2hEi7UU24qPqBGhvynEA0WCZlVy19vvYzQSQxfnIg99w


dw817(Posted 2016) [#5]
Brucey, I tried your Cipher example program. Works fine. Unfortunately it does what every single encryption program I have come across does - except my own.

It saves the results in 8-bit. I need 6-bit output and to use a custom character set like:

"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890. "

Which in checking is exactly 64-characters. These characters are used for input, they are also used for output.