# crypto.pcurves.common: generalize invert\(\) \(\#23039\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/d8d2aa9af438bffa643aabb180011f275afd87d3)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: d8d2aa9af438bffa643aabb180011f275afd87d3

Requested commit: d8d2aa9af438bffa643aabb180011f275afd87d3

Commit: d8d2aa9af438bffa643aabb180011f275afd87d3

Tree: c7ff17b73b194820a1df462bc2055a2b5bfef729

Author: Frank Denis

Committer: GitHub

## Message

```
crypto.pcurves.common: generalize invert() (#23039)

The Bernstein-Yang inversion code was meant to be used only with the
fields we currently use for the NIST curves.

But people copied that code and were confused that it didn't work as
expected with other field sizes.

It doesn't cost anything to make it work with other field sizes,
that may support in the future. So let's do it.
This also reduces the diff with the example zig code in fiat crypto.

Suggested by @Rexicon226 -- Thank you!
```

## Parents

- [a6525c1762733613c13f61ae5cb1fdd1467f7378](https://git.cafe/gitcafe/zig/commit/a6525c1762733613c13f61ae5cb1fdd1467f7378?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/d8d2aa9af438bffa643aabb180011f275afd87d3?format=markdown)
