Provides encryption and decryption routines, such as generation of security codes or identifiers.
The library has 5 functions:
- The parameter is optional, it is a number (int) that indicates the maximum length of the string to be generated. Creates an alphanumeric identifier that can be accompanied by not a substring (_).
- Requires two stgrings as parameters; The first one (pwd) is the password and the second (key) is the key with which it will be coded. Function that generates encryption of the password based on the key, usually the security code (private) that is generated during installation. Tradionally, it was used with the function crypt but this prevented portability to new installations or platforms other than LAMP.
- No parameters required. Generates a base64 identifier of a value based on time. Not recommended for generating identifiers.
- Encrypts an array (arr) by separating the fields by tab and converting the string to base64.
- Reverse function; Takes a string (str) in base64, decrypts it, and delivers an array of fields previously separated by a tab.
Generally used to retrieve information from cookies or generation of new data.