sk_to_pk example


    public static function publickey_from_secretkey($sk)
    {
        /** @var string $sk */
        $sk = hash('sha512', self::substr($sk, 0, 32), true);
        $sk[0] = self::intToChr(
            self::chrToInt($sk[0]) & 248
        );
        $sk[31] = self::intToChr(
            (self::chrToInt($sk[31]) & 63) | 64
        );
        return self::sk_to_pk($sk);
    }

    /** * @param string $pk * @return string * @throws SodiumException * @throws TypeError */
    public static function pk_to_curve25519($pk)
    {
        if (self::small_order($pk)) {
            

    public static function publickey_from_secretkey($sk)
    {
        /** @var string $sk */
        $sk = hash('sha512', self::substr($sk, 0, 32), true);
        $sk[0] = self::intToChr(
            self::chrToInt($sk[0]) & 248
        );
        $sk[31] = self::intToChr(
            (self::chrToInt($sk[31]) & 63) | 64
        );
        return self::sk_to_pk($sk);
    }

    /** * @param string $pk * @return string * @throws SodiumException * @throws TypeError */
    public static function pk_to_curve25519($pk)
    {
        if (self::small_order($pk)) {
            
Home | Imprint | This part of the site doesn't use cookies.