-2

How can I encode string using PHP Base64_encode function with passing some Salt String

I don't want others to hack my string. If some one is having little knowledge in php, he can easily hack if I directly encode string. Because this is the only function allow you to decode encoded content. As far as I know.

In the tutorials I see above function will accept only one parameter.

Any Help ?

Sahal
  • 4,046
  • 15
  • 42
  • 68
  • 1
    If you want to *properly* encrypt a string, don't use base64. Use a proper encryption method instead – Pekka Sep 08 '11 at 08:01
  • What method you are talking about ? – Sahal Sep 08 '11 at 08:02
  • 3
    possible duplicate of [Best way to use PHP to encrypt and decrypt?](http://stackoverflow.com/questions/1289061/best-way-to-use-php-to-encrypt-and-decrypt) – Pekka Sep 08 '11 at 08:04

1 Answers1

4

You should use mcrypt php extension.

Gedrox
  • 3,592
  • 1
  • 21
  • 29
  • This is no longer recommended, use Libsodium - A PHP extension. See here https://stackoverflow.com/questions/41272257/mcrypt-is-deprecated-what-is-the-alternative – Hugo May 23 '23 at 11:01