Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Passing data from one script to another

by dragonchild (Archbishop)
on May 02, 2003 at 15:41 UTC ( [id://255044]=note: print w/replies, xml ) Need Help??


in reply to Passing data from one script to another

Check out Getopt::Long. Also, check out MD5::.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

  • Comment on Re: Passing data from one script to another

Replies are listed 'Best First'.
Re: Re: Passing data from one script to another
by Anonymous Monk on May 02, 2003 at 15:57 UTC
    I have just taken a look at Digest:MD5 and it looks fairly simple to use _if you know how_. How would i pass somethign like $password containing a plain text password thru Digest:MD5 and output the encrypted password as $encr_pass?.

      Like this:

      use Digest::MD5 qw(md5); my $password = "passwd"; my $encr_pass = md5($password);

      But for anything new, you should be using SHA1 (as MD5 is quite possibly on its deathbed as far as security applications go), which is done like this:

      use Digest::SHA1 qw(sha1); my $password = "passwd"; my $encr_pass = sha1($password);

      Unfortunately, Digest::SHA1 doesn't come with Perl by default (the MD5 module does).

      Better still, you can use simply Digest with an OO interface to specify the hash algorithm at runtime. IMHO, its important to be able to switch from one crypto/hash algorithm to another on a moment's notice, in case your current algorithm turns out to have a catastrophic security hole. The Digest.pm module helps you to do that change. Here's how to use it:

      use Digest; my $password = "passwd"; my $digest = Digest->new("SHA1"); $digest->add($password); my $encr_pass = $digest->digest();

      The OO interface in the Digest.pm module is basically the same as the interface in the Digest::MD5 and Digest::SHA1 modules (I used the functional interface for those modules above, for simplicity's sake).

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://255044]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-23 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found