>How can I encrypt a string, example I want to encrypt the password
Basically, you don't. A better idea is to store the value ("digest") of the string when processed through a hash function.
Overview at
https://securityboulevard.com/2020/05/hashing-what-you-need-to-know-about-storing-passwords/
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up