SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Jul 2002
    Location
    Italy
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating a random salt

    I'm trying to find a good way to create a random salt to encrypt a password as in
    PHP Code:
    crypt($pw$salt); 
    I've googled and googled but can't find a suitable answer. One suggestion was
    PHP Code:
    base64_encode($pw); 
    which is hardly random.
    I'm using PHP 5.3
    Any ideas welcome. Thanks.
    blessed are the cracked for they let in the light

  2. #2
    SitePoint Enthusiast bronze trophy \\.\'s Avatar
    Join Date
    Oct 2013
    Location
    UK
    Posts
    72
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What are you wanting to do?

    It is better to know what your needs are and then someone can best advise you.

  3. #3
    SitePoint Addict bronze trophy
    Join Date
    Sep 2005
    Posts
    323
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Why not do...

    Code:
    $password = "hello123";
    $random_salt = md5(rand(1,1000000000000) . date("y-m-d h:i:s") . "8239fjefjwfkk");
    $password = crypt($password, $random_salt);

  4. #4
    SitePoint Evangelist
    Join Date
    Jul 2002
    Location
    Italy
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I want to do is create an encrypted password for use with .htaccess/.htpasswd
    blessed are the cracked for they let in the light

  5. #5
    SitePoint Evangelist
    Join Date
    Jul 2002
    Location
    Italy
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah- thanks Patche!
    blessed are the cracked for they let in the light


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •