PHP code example of noxlogic / oprf

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

    

noxlogic / oprf example snippets


use Noxlogic\Oprf\OprfClient;

$client = new OprfClient();

// Step 1 - blind the input and send $result->blindedElement to the server
$result = $client->blind($input);

// Step 3 - unblind the server's response and compute the pseudonym
$pseudonym = $client->finalize($input, $result->blind, $evaluatedElement);

use Noxlogic\Oprf\OprfServer;

$server = new OprfServer();

// Generate and store a long-lived key
$key = $server->generateKey();

// Step 2 - evaluate the blinded element received from the client
$evaluatedElement = $server->evaluate($key, $blindedElement);

$client = new OprfClient();
$server = new OprfServer();
$key    = $server->generateKey();

$blind     = $client->blind('my-input');
$evaluated = $server->evaluate($key, $blind->blindedElement);
$pseudonym = $client->finalize('my-input', $blind->blind, $evaluated);