Encrypt a text field

Is there a way to encrypt a text field in a custom Doctype in ERPNext using a server script and store the encrypted value in the database?

If I use the “Password” field type, the problem is that I won’t be able to export the data later. Am I correct?

Is there any workaround for this?

My site is hosted on Frappe Cloud.

I’m interested in this as well. For US payroll, have to store the social security number. I really would prefer in the database this be encrypted. But it needs to be visible to HR so I can’t use a password field.