When I try to find an inverse of a scalar, it doesn't work as expected while using the Oblivious.ristretto library.
I tried couple of variations to test out the discrepancy in the behavior.
Here are few of those instances:
#Some scalar s
s = scalar.hash("s".encode())
The scalars for which I am able to get an inverse:
~(s)
~(s * s)
But, if the scalar is of the form (s + s'), I am not able to get the inverse of it.
It throws - TypeError: bad operand type for unary ~: 'bytes'. I also tried using the inverse() method but that failed to work too.
Surprisingly, this error seems to be localised only within the Oblivious.ristretto library. The Oblivious.bn254 works well and behaves as expected.
We tested out these instances on google colab. Adding python code here for reference.
from oblivious.ristretto import point, scalar
s = scalar.hash(b"123")
m = scalar.hash(b"456")
#Works
~(s)
~(s*s)
#Doesn't work
~(s+s)
~(s+m)
Do let me know if you need more context.