Change profile custom fields values

Hi, I use some custom registration / profile fields. I need to use an algorithm to generate several fields content and I do not want the user to insert the values manually (still the user must see the field content).
I can generate in PHP the required value. How do I interact with the profile updates?
I found several hooks but have no idea how to change the value captured from the form into the custom value I calculate for the custom field.
I can generate in PHP the required value. How do I interact with the profile updates?
I found several hooks but have no idea how to change the value captured from the form into the custom value I calculate for the custom field.