cryptimeleon / math

Library providing mathematical basics for (pairing-based) cryptography.
Apache License 2.0
10 stars 2 forks source link

Replace `Zn:getInteger()` usage with `Zn:asInteger()` #107

Closed rheitjoh closed 2 years ago

rheitjoh commented 3 years ago

So since RingElement recently got the new asInteger method, we should use that one instead of the Zn-specific getInteger method. Then we can remove getInteger.

rheitjoh commented 3 years ago

@JanBobolz is this ok btw? I am asking because getInteger explicitly states that it returns an integer in [0,n), while asInteger just states that it inverts the whole getElement method, meaning asInteger could theoretically return something greater than n as long as it is still in the same equivalence class. Maybe we should clarify that or is there meant to be a difference?

JanBobolz commented 3 years ago

No difference intendend. You can add to the Javadoc for asInteger that the result will be between 0 and the ring's characteristic.