double hand encryption with fixed LENGTH

Posted on

Question :

Does anyone know of any way to encrypt some data, two-handle , so that I can decrypt?
The problem is that there is no way to decrypt (unidirectional / one-handle).

base64 is bad for me because it usually increases the size of what I have already written, 30% larger (as described in the manual), and actually the intent of encryption is to decrease …

The text to be encrypted should vary from 10 ~ 100 characters, alpha-numerical, and the field where I want to store the encryption will not accept more than 32.


Answer :

What you are looking for is not encryption (a technique for hiding data) but rather compression (a technique for storing data using fewer bits than in its “raw” format). base64 is neither one nor the other (it’s just a form of serialization – encode an arbitrary binary data into a set of 64 characters).

To represent a data of up to 100 characters in a field of 32 you face a number of problems:

  • No lossless compression algorithm has positive worst-case performance ( Pigeon House Principle ) . This means that there is a lower bound for the space that these 100 alphanumeric characters will occupy, which is as follows:

    • 7 bits to store the size of the sequence (| 10-100 | = 90

Leave a Reply

Your email address will not be published. Required fields are marked *