algorand / algorand/go-algorand

New opcode: modexp

Aperta
#6,139 12 commenti 7 reazioni 1 assegnatario Rivendicata da @jannotti Vedi su GitHub
new-feature-request
Lingua principale
Go
Stelle
1.4k
Fork
537
Merge medio
1g 6h
PR unite (30g)
17

Descrizione

## Problem

I believe `modexp` (modular exponentiation) should be available as an opcode, as it seems like an important crypto primitive. It is also present in many other chains like EVM. While I have implemented its functionality in [Puya BigNumber](https://github.com/Helium-Labs/Puya-BigNumber), I'm afraid its cost is prohibitively expensive for most real-world applications like RSA signature verification. This is why I propose it be made an opcode.

This opcode would pave the way for several novel use cases, such as supporting RSA, which is still a popular cryptographic function seen in many places like JWT verification and DKIM in email.

## Solution

I offer to make a PR adding support for the opcode, updating several source files in `data/transactions/logic` to integrate it. Before creating the PR, I thought it best to raise an issue to provide context and see whether it's something others would like to see added. The API design would be something typical, likely `modexp(base: Bytes, exponent: Bytes, modulus: Bytes)`. The opcode cost would be a function of the input size, similar to `base64_decode`.

## Dependencies

There are no known dependencies.

## Urgency

I am aware of several developers, including myself, who wish to support RSA in some form, such as for DKIM in email or privacy-preserving JWT verification. In that sense, it seems like an important opcode.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.