dev-master
9999999-devPHP Bindings for Blind Hashing
MIT
The Development Requires
by Brad Berger
by Jeremy Spilman
hash hashing salt blind taplink
Wallogit.com
2017 © Pedro Peláez
PHP Bindings for Blind Hashing
If you're using composer:, (*2)
composer require taplink/taplink-php
Otherwise, include the src/TapLink/TapLink/Client.php and src/TapLink/TapLink/Response.php files., (*3)
<?php
require_once __DIR__ . '/vendor/autoload.php';
use \TapLink\TapLink\Client;
$appId = "my-app-id";
$taplink = new Client($appId);
$hash = hash_hmac(Client::$hashAlgorithm, "secret", hex2bin("4cb78a1a60599df9c3bd9e4ac741a5f15feec1812b22a5f15bbad978039f2765f00dd82d97272eb3674cd164a0cc7024bbfd3704c6df6e2cb17a6562bd96ecb7"));
$res = $taplink->getSalt($hash);
if ($res->err) {
echo "An error occurred: ".$res->err;
return;
}
echo "===================================\n";
echo "Version: {$res->versionId}\n";
echo "New version id: {$res->newVersionId}\n";
echo "Salt2Hex: {$res->salt2Hex}\n";
echo "New Salt2Hex: {$res->newSalt2Hex}\n";
echo "===================================\n";
$res = $taplink->newPassword($hash);
if ($res->err) {
echo "An error occurred: ".$res->err;
return;
}
echo "Version: {$res->versionId}\n";
echo "Salt2Hex: {$res->salt2Hex}\n";
echo "Hash2Hex: {$res->hash2Hex}\n";
echo "New version id: {$res->newVersionId}\n";
echo "New Salt2Hex: {$res->newSalt2Hex}\n";
echo "===================================\n";
$res = $taplink->verifyPassword($hash, "expected-hash");
if ($res->err) {
echo "An error occurred: ".$res->err;
return;
}
echo sprintf("Match: %s\n", $res->matched ? "true" : "false");
echo "Version: {$res->versionId}\n";
echo "Salt2Hex: {$res->salt2Hex}\n";
echo "Hash2Hex: {$res->hash2Hex}\n";
echo "New version id: {$res->newVersionId}\n";
echo "New Salt2Hex: {$res->newSalt2Hex}\n";
echo "===================================\n";
PHP Bindings for Blind Hashing
MIT
hash hashing salt blind taplink