2021.07.15 2021.11.11 2021.11.15 article Amenoum How to code a simple and fast crypter. computer science and engineering encryption, decryption, xor, crypter /authors/Amenoum.html#credits Tutorial on crypting and notes on hidden variables Intro 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 on that body. 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. Understanding between two living universes can only increase with shared evolution but can never be complete due to inherent inability to decrypt all the scales of its expression. Symbiosis, paradoxically, doesn't require increase in understanding, but ignorance of differences which then evolve compatibility to share space/time. With the increase of understanding of its self, that space/time will increase its distinct individuality, increasing introversion. Thus, in order for us to understand each other at all, it must be impossible for any one to completely understand its self. The choice of what to hide and when will depend on how we [want to] evolve.
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. 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 perhaps 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.
Building encryption 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 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 and desktop coding. It's what I use nowadays for all my backend coding. 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.
operatorfunctiondescription
=assignmentassigns 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
&&logical ANDreturns true if both expressions (left and right) evaluate to true
||logical ORreturns true if at least one of the expressions (left or right) evaluate to true
.concatenationappends evaluated expression on the right to the left and returns the result (string)
.=assignment with concatenationappends evaluated expression on the right to the contents of a variable on the left, storing the result in the same variable
!logical negationevaluates expression on the right and returns its negation (inversion) - converts true to false and vice versa
^bitwise XORevaluates left and right expression and performs bitwise XOR operation between every bit, returning the result
Table 1: PHP operators used in code

Source code:

crypt.php
+


Article revised.