PHP code example of elegasoft / cipher

1. Go to this page and download the library: Download elegasoft/cipher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elegasoft / cipher example snippets


// It only encodes characters in its character base
$cipher = new Base62Cipher(config('cipher.keys.base62'));
$cipher->encipher('hide-this-string-1111');
// returns 39O8-RBeX-4ZyGD6-o8pR
$cipher->decipher('39O8-RBeX-4ZyGD6-o8pR');
// returns hide-this-message


// It can encipher symbols in its character base
$cipher = new Base96Cipher(config('cipher.keys.base96'));
$cipher->encipher('hide-this-string-1111');
// returns (3]QC+2}SsoHzRz14I<~L
$cipher->decipher('(3]QC+2}SsoHzRz14I<~L');
// returns hide-this-message

$cipher = new Base96Cipher(config('cipher.keys.base96'));
// It can pad the enciphered text to a minimal output length of 6
$cipher->paddedEncipher(string: 1, minOutputLength: 6, paddingCharacter: 'a');
// returns q3sp14
$cipher->paddedDecipher(encipheredString: 'q3sp14', paddingCharacter: 'a');
// return 1

// For example
$cipher = new Base62Cipher(config('cipher.keys.base62'));
$cipher->encipher('bat'); // Outputs eaO
$cipher->encipher('cat'); // Outputs koB
$cipher->encipher('hat'); // Outputs 3A9
$cipher->encipher('mat'); // Outputs PX2

$cipher = new Base62Cipher(config('cipher.keys.base62'))
$cipher->encipher('aaaaaaaa') // Outputs tW7vz1pT
$cipher->encipher('aaaaaaab') // Outputs tW7vz1pu
$cipher->encipher('aaaaaaac') // Outputs tW7vz1pn
$cipher->encipher('aaaaaaad') // Outputs tW7vz1p7


$cipher = new Base62Cipher(config('cipher.keys.base62'))
$cipher->reverseEncipher('aaaaaaaa') // Outputs tW7vz1pT
$cipher->reverseEncipher('aaaaaaab') // Outputs ea5H4Kt2
$cipher->reverseEncipher('aaaaaaac') // Outputs kouIgSfE
$cipher->reverseEncipher('aaaaaaad') // Outputs r4m7jswy