-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/sha and hash to field #5
Feat/sha and hash to field #5
Conversation
Update upstream + add u512 mod p
def hex_to_chunks_32(hex_string: str): | ||
# Remove '0x' prefix if present | ||
if hex_string.startswith(('0x', '0X')): | ||
hex_string = hex_string[2:] | ||
|
||
# if we have an odd number of characters, prepend a 0 | ||
if len(hex_string) % 2 == 1: | ||
hex_string = '0' + hex_string | ||
|
||
# Now split into 8-character (32-bit) chunks | ||
chunks = [int(hex_string[i:i+8], 16) for i in range(0, len(hex_string), 8)] | ||
return chunks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use garaga.hints.io.bigint_split
It Works with bytes as well.
chunks = io.bigint_split(hasher.digest(), 8, 2**32)[::-1]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super neat these functions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test keeps breaking, as I have variable length inputs, and need to compute n_limbs which keeps going wrong.
2965790
to
342a217
Compare
342a217
to
21457b9
Compare
Pull Request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this introduce a breaking change?
Other information