PHPackages                             paragonie/ristretto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. paragonie/ristretto

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

paragonie/ristretto
===================

Type-safe API for the Ristretto255 group

v0.1.0(3y ago)2241ISCPHPPHP ^8.1

Since Jun 10Pushed 3y ago3 watchersCompare

[ Source](https://github.com/paragonie/ristretto-php)[ Packagist](https://packagist.org/packages/paragonie/ristretto)[ RSS](/packages/paragonie-ristretto/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Ristretto (PHP)
===============

[](#ristretto-php)

[![Build Status](https://github.com/paragonie/ristretto-php/actions/workflows/ci.yml/badge.svg)](https://github.com/paragonie/ristretto-php/actions)[![Latest Stable Version](https://camo.githubusercontent.com/a857a5f9e11da38c81a8db17072bf54585e8d3a3e408afc3d49c6ea21b8641eb/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f72697374726574746f2f762f737461626c65)](https://packagist.org/packages/paragonie/ristretto)[![Latest Unstable Version](https://camo.githubusercontent.com/d938e4398c24b5c02100e23635c8d1b58df86c58ba646fccb1518fa67731bcc8/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f72697374726574746f2f762f756e737461626c65)](https://packagist.org/packages/paragonie/ristretto)[![License](https://camo.githubusercontent.com/0cacf01cca86b80b3508bf4b8ee8bad26d8105635f7b381664aee1f9afe260de/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f72697374726574746f2f6c6963656e7365)](https://packagist.org/packages/paragonie/ristretto)[![Downloads](https://camo.githubusercontent.com/b479ea561d6331a9886a08a46c2aacceeff40741821acfaa7e8b958c1dbf8d6d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70617261676f6e69652f72697374726574746f2e737667)](https://packagist.org/packages/paragonie/ristretto)

Implements a type-safe API for working with [the Ristretto Group](https://ristretto.group)in PHP projects.

Requirements
------------

[](#requirements)

- **PHP 8.1 or newer**

Installing
----------

[](#installing)

```
composer require paragonie/ristretto

```

Documentation
-------------

[](#documentation)

There are two basic types: `ScalarValue` and `GroupElement`.

The `ScalarValue` object wraps a big integer between 0 and the order of the Ristretto Group, `L`.

The `GroupElement` object wraps a group element of the Ristretto Group.

If an analogy helps, in the world of Ed25519 and X25519, the `ScalarValue` is your secret key, and `GroupElement` is your public key.

For that reason, there are also a `SecretKey` and `PublicKey` class, which contains some basic helper methods for ease-of-use.

Usage
-----

[](#usage)

You can convert from scalars to group elements with `multBase()`, and then use `scalarPointMultiply()` to perform a commutative group action (e.g. Diffie-Hellman).

```
