Search code examples
phppassword-encryption

What's the safest and quickest way of encrypting a password if I migrate a website?


Can you advise on the quickest way I could encrypt a password and keep it secure? And is there a way to transfer it? (I need PHP encryption)

What I want is to probably migrate the site to another server and I wanna know if all the passwords will still be functioning?


Solution

  • It really depends on what the passwords are used for, maybe you could explain a bit more.

    1. They are user passwords used to authenticate the users, then they should be hashed with password_hash(). Most other languages offer similar hash functions, especially when used with the parameter PASSWORD_BCRYPT.
    2. They are used to login e.g. to a database, then they could be encrypted, but this leads to question of how to store the key. It depends on the target system how safe you can store those passwords.