PHP code example of tricioandrade / openscrypt

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

    

tricioandrade / openscrypt example snippets



    $instance = new GenerateKeys();
    $instance->generate();
    
    // Print or save your keys anywere 
    $instance->getKeys();

    $instance = new GenerateKeys(__DIR__ . '\\');

    $instance = new GenerateKeys(__DIR__ . '\\');
    $instance->generate();
    
    if ($instance->isPem()){
        print_r($instance->getKeysPath());
    }
    else{
        print_r($instance->getKeys());
    }

    $instance->privateKeyFileName   = 'MyPrivateKey.pem';
    $instance->publicKeyFileName    = 'MyPublicKey.pem';

    $cypher = new Cypher('Hello');
        
    print_r(
        $cypher->setCypherKey(file_get_contents('./MyPrivateKey.pem'))
        ->getHash()
    );