2021.07.15articleAmenoumHow to code a simple and fast crypter.computer science and engineeringencryption, decryption, xor, crypter/authors/Amenoum.html#creditsTutorial on crypting and notes on hidden variablesIntro
Generally, encryption is expression in a language one does not understand. However, if one knows the translating (decrypting) algorithm, no one needs to understand that language in order to
translate the expression to understandable one.
To know the mechanics of a body of a universe is to master computer science, engineering and reverse engineering.
To understand its nature is to understand everything beyond the mechanic horizon.
In its essence, understanding is decryption, and, generally, to understand a universe is to build a decryption algorithm without understanding the evolving language of evolving expression.
Encryption today is very popular. However, most of encryption is not in control of the end user.
This is a small tutorial, showing how to code a simple and fast crypter, as secure as you want it to be. The code is thoroughly commented so it may also teach you basics of programming.
While encryption (hiding stuff) is common in polarized society, one may wonder whether it has its use in neutralum society.
Perhaps this could be rephrased - does non-polarized nature use encryption, consciously?
Relatively, nature does use encryption. Ie. we cannot see standard atoms directly, but we can see them on a large scale. Yet, a particular standard atom cannot be seen in great details.
And there are even smaller and larger stuff we are not aware of (although these may be relatively equal to stuff we do see).
So, there are hidden things and things we cannot decrypt, but that's reasonable. If everything would be revealed, it would be overwhelming and we couldn't exist (evolve), as per postulates
of CR, absolute is equivalent to non-existing.
But are hidden variables always non-consciously hidden? No, by polarized entities, they can, and at times will, be hidden consciously.
I still like and want privacy, but I believe that is only due to the fact I'm surrounded by polarized people - people who like to invade and exploit everything, including privacy, people who do not
value what they do not understand and aim (often literally) to reduce it to something they can [believe to] understand.
I believe privacy would be unnecessary between neutralums, but no society can be isolated, so something would be hidden to other species, even if not consciously.
Here, an input file will be encrypted using nothing but the XOR operator between input bytes (bits) and the provided key (password).
This makes the encryption trivial (it cannot get simpler than that) and fast. This also means the same program can be used to encrypt and decrypt files.
If you want to decrypt, you only need to specify the encrypted file as input and output will be the original (decrypted) file, instead of the other way around.
The strength of the encryption is proportional to the length of your key and its randomness. If your key is random enough and longer than input, and if the attacker does not know what to
expect (and where) in the decrypted file, your encryption will be unbreakable.
For best security you don't want to store your key anywhere, you want to remember it. This may seem impossible because the key is also supposed to be random and long for best security.
However, there is a way to use small and non-random phrases and still get practically unbreakable encryption.
The condition for this is that you have a key generator somewhere which would generate the key to be used in encryption from a short and memorable phrase you specify.
This key generator may simply apply some hash function (like md5) to your input multiple times to generate a very long key, but it is imperative here that the attacker does not suspect such
key generator was used and, most importantly, that it does not know its algorithm and its location.
The code below is written in PHP language. Why PHP? PHP has a C syntax, works the same on different platforms, it's simple and lightweight to install and use and can be used for both, web
programming and local programming. It's what I use nowadays for all my backend programming.
Some might say that's the real reason why I use it here too...
The PHP code in a file starts with <?php tag and ends with a closing ?> tag (which may be omitted if it would be at the end of a file). Anything outside is not interpreted
by PHP and will generally be printed to output - usually screen of a command line interface (CLI) or a browser (which will generally parse it as HTML code or plain text).
Anything within /* and */ tags is considered a comment and is ignored by PHP parser. However, comments are often used to describe what the code does.
The /* and */ are generally used for multi-line comments. For single line comments, it is more convenient to use //. Anything starting with // to the end of the line is
then considered a comment.
Note that, in PHP, variables must start with a dollar ($) sign.
Operators used in the code are described in Table 1.
assigns the value or result of an expression [on the right of the operator] to a variable specified on the left of the operator
comparison (tests for non-equality)
returns true (boolean) if expression on the left evaluates to something different to expression on the right of the operator, false otherwise
comparison (tests for equality)
returns true if expression on the left evaluates to something equal to expression on the right of the operator, false otherwise
comparison (tests for equality)
the same as ==, except it also checks if data types are equal, ie. if there's 0 (integer) on the left and '0' (string) on the right, this will return false, whereas == would return true
returns true if both expressions (left and right) evaluate to true
returns true if at least one of the expressions (left or right) evaluate to true
appends evaluated expression on the right to the left and returns the result (string)
assignment with concatenation
appends evaluated expression on the right to the contents of a variable on the left, storing the result in the same variable
evaluates expression on the right and returns its negation (inversion) - converts true to false and vice versa
evaluates left and right expression and performs bitwise XOR operation between every bit, returning the result