ristretto255_frombytes example


    public static function ristretto255_is_valid_point($p$dontFallback = false)
    {
        if (self::useNewSodiumAPI() && !$dontFallback) {
            return sodium_crypto_core_ristretto255_is_valid_point($p);
        }
        try {
            $r = ParagonIE_Sodium_Core_Ristretto255::ristretto255_frombytes($p);
            return $r['res'] === 0 &&
                ParagonIE_Sodium_Core_Ristretto255::ristretto255_point_is_canonical($p) === 1;
        } catch (SodiumException $ex) {
            if ($ex->getMessage() === 'S is not canonical') {
                return false;
            }
            throw $ex;
        }
    }

    /** * @param string $p * @param string $q * @param bool $dontFallback * @return string * @throws SodiumException */
self::ge_p1p1_to_p3($p_p1p1)
        );
    }

    /** * @param string $p * @return int * @throws SodiumException */
    public static function is_valid_point($p)
    {
        $result = self::ristretto255_frombytes($p);
        if ($result['res'] !== 0) {
            return 0;
        }
        return 1;
    }

    /** * @param string $p * @param string $q * @return string * @throws SodiumException */
Home | Imprint | This part of the site doesn't use cookies.