The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Perl commandline guru advice needed...

Discussion in 'General Discussion' started by rs-freddo, Feb 1, 2005.

  1. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    I'm writing a PHP script that needs to use the perl crypt function to hash a string. The easiest way to do this is to do the perl crypt function on the commandline. Currently I get no output, so I'm doing something wrong.

    I've tried:
    perl -e -p "crypt(string, salt);"
    and various permutations, with no output. Any ideas what I'm doing wrong?

    My last resort will be to write a small perl script to do the crypt and generate output - i know that will work.
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    If you want a (mostly) random salt:

    perl -e "print crypt ('test',rand(time))"
     
  3. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Thanks chirpy, that worked.
     
Loading...

Share This Page