Skip to content

Conversation

@berZKerk
Copy link

Problem

FieldImpl::from_bytes_le() sometimes produces incorrect results when converting random bytes to field elements, leading to arithmetic inconsistencies and failed polynomial evaluations.

Root Cause

FFI function _from_bytes_le uses TYPE::reduce_from_bytes() which doesn't properly handle values larger than the field modulus.

Solution

Replace TYPE::reduce_from_bytes() with TYPE::from() which uses a robust reduction algorithm with precomputed values and Barrett reduction.

Fixes #997

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@berZKerk
Copy link
Author

I have hereby read the ICICLE CLA and agree to its terms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Expected Behavior of FieldImpl::from_bytes_le()

1 participant