You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working on a codebase and am encountering an issue when trying to convert a decrypted message of type QuadExtField<Fp12ParamsWrapper<Fq12Parameters>> back to its original hexadecimal string format.
Here's a snippet of the code:
let my_str = "00000000000000008a7f5d0f15ef296b1d80813c63241ff1952a1d3d4fbd0cb8008242f1000e3bb7";// Serialize the input hexadecimal stringletmut bytes:Vec<u8> = hex::decode(my_str).unwrap();let m = Fq12::from_random_bytes(&data).unwrap();// Encrypt the messagelet ct = enc(&pk,0, m);// Decrypt the ciphertextlet decrypted_m = dec(&mut sk,&ct);// Type: QuadExtField<Fp12ParamsWrapper<Fq12Parameters>>
When I try to convert decrypted_m back to bytes and then to a hex string, the output is incorrect. Instead of getting the original my_str, I end up with a padded and incorrect result, such as:
How can I correctly convert QuadExtField<Fp12ParamsWrapper<Fq12Parameters>> back to the original hexadecimal string (my_str)?
Is there a specific deserialization method or field extraction process I need to follow for this type?
Additional Context:
I’m using Fq12 for cryptographic operations.
The encryption and decryption steps work as expected, but the deserialization back to the original hex string is not producing the correct output.
Any guidance or references to examples would be greatly appreciated!
Thank You:
Thanks in advance for your help! 😊
The text was updated successfully, but these errors were encountered:
vinay10949
changed the title
How to Convert QuadExtField<Fp12ParamsWrapper<Fq12Parameters>> Back to Original Hex String?
How to Convert QuadExtField<Fp12ParamsWrapper<Fq12Parameters>> Back to Original Hex?
Dec 2, 2024
I’m working on a codebase and am encountering an issue when trying to convert a decrypted message of type
QuadExtField<Fp12ParamsWrapper<Fq12Parameters>>
back to its original hexadecimal string format.Here's a snippet of the code:
When I try to convert
decrypted_m
back to bytes and then to a hex string, the output is incorrect. Instead of getting the originalmy_str
, I end up with a padded and incorrect result, such as:Also details
Question:
QuadExtField<Fp12ParamsWrapper<Fq12Parameters>>
back to the original hexadecimal string (my_str
)?Additional Context:
Fq12
for cryptographic operations.Thank You:
Thanks in advance for your help! 😊
The text was updated successfully, but these errors were encountered: