PHP code example of amculin / vigenere-cipher

1. Go to this page and download the library: Download amculin/vigenere-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/ */

    

amculin / vigenere-cipher example snippets


use amculin\cryptography\classic\VigenereCipher;

$data = 'testtheencryptionprocess';
$key = 'thisisthekey';

//Basic mode only support lowercase alphabet
//You can use alpha_numeric mode for wider supported characters (a-z, A-Z, 0-9)
$encrypted = VigenereCipher::encrypt($data, $key, 'basic');

echo "Plain text: {$data}\n";
echo "Key: {$key}\n";
echo "Cipher Text: {$encrypted}\n";

use amculin\cryptography\classic\VigenereCipher;

$data = 'mlalbzxlrmvwiaqgvhkvgowq';
$key = 'thisisthekey';
$decrypted = VigenereCipher::decrypt($data, $key, 'basic');

echo "Cipher text: {$data}\n";
echo "Key: {$key}\n";
echo "Plain Text: {$decrypted}\n";