PHP code example of nsp-team / crypt-tool

1. Go to this page and download the library: Download nsp-team/crypt-tool 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/ */

    

nsp-team / crypt-tool example snippets




use NspTeam\Crypt\Crypt;

$secretKey = "1234567890123456";

//1. Encrypt and Encode plain text data for storage or transmission 
$encodedEncryptedData = (new Crypt($secretKey))->encrypt("message");

//2. Decoding and Decrypting stored or received data
$encodedEncryptedData = (new Crypt($secretKey))->decrypt("encoded_encrypted_data");

//3. Encrypting and Decrypting with an alternate length initialization vector

$crypt = new Crypt($secretKey);

$alternateIVLength = 8;
$encodedEncryptedData = $crypt->encrypt("message", $alternateIVLength);
$plainText = $crypt->decrypt($encodedEncryptedData, $alternateIVLength);