Skip to content

Lib failed comparison agains trusty native Curve25519 #18

@AsenOsen

Description

@AsenOsen

I`ve decided to compare basic calculation of public key based on private key against Curve25519:

$secureRandom = openssl_random_pseudo_bytes ( 32);
// native curve25519.so
$trusty_private = curve25519_private($secureRandom);
$trusty_public = curve25519_public($trusty_private);

// this library
$ec = new EC('curve25519');
$untrusty_keypair = $ec->keyFromPrivate(bin2hex($trusty_private));
$untrusty_public = $untrusty_keypair->getPublic(true, 'hex');

echo $untrusty_public . PHP_EOL;
echo bin2hex($trusty_public) . PHP_EOL;

and this check has failed:

6aa466621807d91ec5a6777544a6796fde5adf8b72a842b23c25f0c479f3aa71
d323bc8387b836dca1cc42fb8f53cb533ff5eaaf2461adc8ef698640bd614a4b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions