$hs =
hash_init('sha512'
);
self::
hash_update($hs, self::
substr($az, 32, 32
));
self::
hash_update($hs,
$message);
$nonceHash =
hash_final($hs, true
);
# memmove(sig + 32, sk + 32, 32);
$pk = self::
substr($sk, 32, 32
);
# sc_reduce(nonce);
# ge_scalarmult_base(&R, nonce);
# ge_p3_tobytes(sig, &R);
$nonce = self::
sc_reduce($nonceHash) . self::
substr($nonceHash, 32
);
$sig = self::
ge_p3_tobytes( self::
ge_scalarmult_base($nonce) );
# crypto_hash_sha512_init(&hs);
# crypto_hash_sha512_update(&hs, sig, 64);
# crypto_hash_sha512_update(&hs, m, mlen);
# crypto_hash_sha512_final(&hs, hram);
$hs =
hash_init('sha512'
);
self::
hash_update($hs, self::
substr($sig, 0, 32
));
self::
hash_update($hs, self::
substr($pk, 0, 32
));