Fascinating cryptography or research on the topic of reversible encryption in PHP
One of the main truths of cryptography is that you should not invent anything in this area if you are not a professional. This is partly true, because all the best has long been invented, suffered and used for more than a decade in the field of information technology. The other side of the truth is that the development of some area of knowledge occurs only with a constant influx of fresh ideas and original solutions in it.
For obvious reasons, we will not attack the giants of industrial cryptography like AES, but plunge into our own cryptographic research with blackjack and jokes.
The SymCoder class includes encryption and decryption methods.
Encryption is performed by the code () method, which takes the input message at the input.
Here, the message on the generated matching table in tab_coded creates an encrypted message, diluted at the edges and inside with noise symbols.
Noise symbols by the way are unique for each sender-destination channel, since they are generated using the channel key, but are not unique to messages. The characters used for encryption in code_symbols are some punctuation marks and characters of the form%, @, etc.
For each encoded character, there are two symbols from code_symbols for obvious reasons, that they are several times smaller than encoded symbols.
The create_tab_coded match table is constructed by translating the hash of the message key to an array with the number of elements equal to the number of elements in the code symbol array. The start position of traversing two-character codes is also always different and is related to the channel key. This makes it possible to be sure that the algorithm for bypassing the encoded symbols and matching them with code symbols is always (well, or guaranteed often) different.
For example, the message "hello, the world" being encoded looks like this:
Digest-a00bf11d - &? == &! &?. @. @ =! = -.? & 1. # &? =:.:. 1%! & -% @ & @% ~ & 1 ^ # =? %% .!% +.?. ~ =? &?% &&:% ~ .#%@&1&1.#=?.#.?.!&1==&=.-=!
And here is the same message encoded again:
Digest-a00bf11d - =:.? =: &!.?. 1 & - = # =: =? = =??! = =! = 1% %.!% + = :. ~. @ ==% && 1% ~ .1% @ =?. @.! & =.! & @ =: & 1. ==: = !. 1 & # &:
It can be seen that the digest of the same message is the same, but the cipher becomes different - noise symbols are added by arbitrary correspondence and in random order for each new encryption.
Messages have redundancy, which decreases as the message volume grows, reaching 10% of noise in the limit (for the shortest messages, the noise reaches 90% and above the percentage), the minimum length of the encrypted message is 116 characters. One of the disadvantages of this method of encryption is that the encoded messages are increased at least twice.
Decoding consists in the reverse translation of the form "code symbol" - the original symbol with the noise cut out from the message. What could be the key? In principle, any string that is unique for each destination-destination pair.
For example, if you create a messenger with message encryption, then the simplest version of the private key can be md5 ($ user_id_1. $ Salt. $ User_id_2), then the key will be unique for each message channel.
It may be interesting
Miro Paris vous propose une large gamme d'accessoire de beauté, maquillage, skincare, kbeauty, crèmes en provenance de Corée du sud, Japon, et Hong Kong. Check Out: Cosmétiques Asiatiques