PHP code example of kba-team / data-protection

1. Go to this page and download the library: Download kba-team/data-protection 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/ */

    

kba-team / data-protection example snippets



use kbATeam\DataProtection\SecureSearch;
//generate a key
$key_hex = SecureSearch::generateKey();
//print the result
printf('%s%s', $key_hex, PHP_EOL);


use kbATeam\DataProtection\SecureSearch;
//convert the key to its raw version
$key_raw = hex2bin($key_hex);
//set the social security number
$ssn = 1234567890;
//encrypt the social security number
$ssn_encrypted = SecureSearch::encrypt($ssn, $key_raw);
//print the result
printf('%s%s', $ssn_encrypted, PHP_EOL);