[29023] in Perl-Users-Digest
Perl-Users Digest, Issue: 267 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 27 16:10:18 2007
Date: Tue, 27 Mar 2007 13:09:24 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 27 Mar 2007 Volume: 11 Number: 267
Today's topics:
any quick and dirty code out there <goodm2@netzero.net>
Re: any quick and dirty code out there <glex_no-spam@qwest-spam-no.invalid>
Re: any quick and dirty code out there <simon.chao@fmr.com>
Re: any quick and dirty code out there <bik.mido@tiscalinet.it>
Behaviour when printing quoted ARRAY <awkster@yahoo.com>
Re: Behaviour when printing quoted ARRAY <spamtrap@dot-app.org>
Re: Behaviour when printing quoted ARRAY <awkster@yahoo.com>
Re: Behaviour when printing quoted ARRAY <bik.mido@tiscalinet.it>
Re: Behaviour when printing quoted ARRAY <bik.mido@tiscalinet.it>
Re: Behaviour when printing quoted ARRAY <awkster@yahoo.com>
Re: CGI URL Redirect krakle@visto.com
Changing one array affects the other <findingAri@gmail.com>
Re: Changing one array affects the other <spamtrap@dot-app.org>
Re: Changing one array affects the other <paduille.4060.mumia.w+nospam@earthlink.net>
Creating empty variables for input data <BradenM@SonomaComputer.com>
Re: Creating empty variables for input data <spamtrap@dot-app.org>
Re: Creating empty variables for input data <bik.mido@tiscalinet.it>
Re: Creating empty variables for input data <spamtrap@dot-app.org>
Re: Encrypting long passwords <josef.moellers@fujitsu-siemens.com>
Re: Encrypting long passwords <bik.mido@tiscalinet.it>
Re: Encrypting long passwords <keith.willis@aah.co.uk>
Re: Encrypting long passwords <bik.mido@tiscalinet.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Mar 2007 11:45:46 -0700
From: "=?iso-8859-1?B?TXIuRyAoQL9AKQ==?=" <goodm2@netzero.net>
Subject: any quick and dirty code out there
Message-Id: <1175021146.469641.128250@d57g2000hsg.googlegroups.com>
Hi, I have a form writen and up to the submit button is all that I can
go. Now what I need is a place where I can get some quick and dirty
cgi/peal code to collect the input. It's only two inputs (name and
zip) the name of the ACTION is called namezip.pl. But like I said that
is as far as I got.
Thanks in advance for any help
------------------------------
Date: Tue, 27 Mar 2007 13:55:57 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: any quick and dirty code out there
Message-Id: <460968bd$0$503$815e3792@news.qwest.net>
Mr.G (@¿@) wrote:
> Hi, I have a form writen and up to the submit button is all that I can
> go. Now what I need is a place where I can get some quick and dirty
> cgi/peal code to collect the input. It's only two inputs (name and
> zip) the name of the ACTION is called namezip.pl. But like I said that
> is as far as I got.
> Thanks in advance for any help
>
For future posts, please choose a more descriptive subject.
perldoc CGI
------------------------------
Date: 27 Mar 2007 11:56:52 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: any quick and dirty code out there
Message-Id: <1175021812.492076.307470@p77g2000hsh.googlegroups.com>
On Mar 27, 2:45 pm, "Mr.G (@=BF@)" <goo...@netzero.net> wrote:
> Hi, I have a form writen and up to the submit button is all that I can
> go. Now what I need is a place where I can get some quick and dirty
> cgi/peal code to collect the input. It's only two inputs (name and
> zip) the name of the ACTION is called namezip.pl. But like I said that
> is as far as I got.
> Thanks in advance for any help
Check out the CGI module.
http://search.cpan.org/~lds/CGI.pm-3.27/CGI.pm
Pay particular attention to the param() method.
------------------------------
Date: Tue, 27 Mar 2007 21:51:32 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: any quick and dirty code out there
Message-Id: <mcti03t0e9ph8qgktbu9cqp4r5a1jsbb2b@4ax.com>
On 27 Mar 2007 11:45:46 -0700, "Mr.G (@¿@)" <goodm2@netzero.net>
wrote:
>Subject: any quick and dirty code out there
Is this a question? If so, then... tons of! So what?
>Hi, I have a form writen and up to the submit button is all that I can
>go. Now what I need is a place where I can get some quick and dirty
>cgi/peal code to collect the input. It's only two inputs (name and
>zip) the name of the ACTION is called namezip.pl. But like I said that
>is as far as I got.
perldoc CGI
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 26 Mar 2007 13:27:15 -0700
From: "Jorge" <awkster@yahoo.com>
Subject: Behaviour when printing quoted ARRAY
Message-Id: <1174940835.707802.198100@e65g2000hsc.googlegroups.com>
Having read the faq's and several articles on this forum, I have a
pretty good feel for why one needs to be careful when quoting
variables and in particular about overusing the quotes and I have
adjusted my coding style accordingly. :)
For the most part, it all makes sense, particularily some of the
points involving not quoting references and variables when it's not
clear whether the variable is a string or otherwise typed and so on.
That said however -- below I show 4 cases of printing ARRAY, each
being a different scenario of quotes (or lack of).
Of particular question is Case 3 which is ARRAY with strings
concantenated, one appended and one prepended to the ARRAY in which
case it prints the number of elements in ARRAY (scalar(@fields)) where
I had expected it to print the same as Case 2 or Case 4 where ARRAY is
enclosed in quotes.
I'm thinking there is there a level of coercion going on that doesn't
show itself.
Shedding light on this will be greatly appreciated.
Thanks, Jorge
use strict;
my @fields = ("zero", "one", "two", "three", "four");
print "\n\n";
# Case 1
print "This is bare ARRAY ...\n";
print @fields;
print "\n\n";
# Case 2
print "This is quoted ARRAY ...\n";
print "@fields";
print "\n\n";
# Case 3
print "this is ARRAY with concatenated strings ...\n".@fields."\n\n";
# Case 4
print "this is ARRAY enclosed in string ... @fields ... \n\n";
------------------------------
Date: Mon, 26 Mar 2007 16:46:48 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Behaviour when printing quoted ARRAY
Message-Id: <m2bqif68cn.fsf@local.wv-www.com>
"Jorge" <awkster@yahoo.com> writes:
> Of particular question is Case 3 which is ARRAY with strings
> concantenated, one appended and one prepended to the ARRAY in which
> case it prints the number of elements in ARRAY (scalar(@fields)) where
> I had expected it to print the same as Case 2 or Case 4 where ARRAY is
> enclosed in quotes.
You need to adjust your expectations. :-)
> # Case 3
>
> print "this is ARRAY with concatenated strings ...\n".@fields."\n\n";
The . operator concatenates strings. Strings are scalars, so scalar context
is forced on its operands. What's the value of an array in scalar context?
The number of elements.
If you want to concatenate the elements of an array with a string, use the
built-in join() function:
print "concatenation ...\n" . join('', @fields) . "\n\n";
Also, if all you're doing is printing the result, concatenation is wasteful
to begin with. Print() takes a list, so the effort involved in creating a
temporary string for print()ing is unnecessary. Better:
print "just pass a list...\n", @fields, "\n\n";
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 26 Mar 2007 14:47:50 -0700
From: "Jorge" <awkster@yahoo.com>
Subject: Re: Behaviour when printing quoted ARRAY
Message-Id: <1174945670.333246.257330@d57g2000hsg.googlegroups.com>
On Mar 26, 1:46 pm, Sherm Pendley <spamt...@dot-app.org> wrote:
> "Jorge" <awks...@yahoo.com> writes:
> > Of particular question is Case 3 which is ARRAY with strings
> > concantenated, one appended and one prepended to the ARRAY in which
> > case it prints the number of elements in ARRAY (scalar(@fields)) where
> > I had expected it to print the same as Case 2 or Case 4 where ARRAY is
> > enclosed in quotes.
>
> You need to adjust your expectations. :-)
>
> > # Case 3
>
> > print "this is ARRAY with concatenated strings ...\n".@fields."\n\n";
>
> The . operator concatenates strings. Strings are scalars, so scalar context
> is forced on its operands. What's the value of an array in scalar context?
> The number of elements.
>
> If you want to concatenate the elements of an array with a string, use the
> built-in join() function:
>
> print "concatenation ...\n" . join('', @fields) . "\n\n";
>
> Also, if all you're doing is printing the result, concatenation is wasteful
> to begin with. Print() takes a list, so the effort involved in creating a
> temporary string for print()ing is unnecessary. Better:
>
> print "just pass a list...\n", @fields, "\n\n";
>
> sherm--
>
> --
> Web Hosting by West Virginians, for West Virginians:http://wv-www.net
> Cocoa programming in Perl:http://camelbones.sourceforge.net
Thank you Sherm
Understood -- I should have been looking more closely at the .
operator to explain the coercion to scalar context -- not so much the
quotes themselves. Subtle stuff.
Thanks again
Jorge
------------------------------
Date: Tue, 27 Mar 2007 00:06:14 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Behaviour when printing quoted ARRAY
Message-Id: <argg039i2og09ugn2u5pfbljfpildq25th@4ax.com>
On 26 Mar 2007 13:27:15 -0700, "Jorge" <awkster@yahoo.com> wrote:
>Of particular question is Case 3 which is ARRAY with strings
>concantenated, one appended and one prepended to the ARRAY in which
>case it prints the number of elements in ARRAY (scalar(@fields)) where
>I had expected it to print the same as Case 2 or Case 4 where ARRAY is
>enclosed in quotes.
You expected wrong. Concatenation forces *scalar context*. Indeed
sometimes one uses C<''.> as a cheap synonim for scalar().
>I'm thinking there is there a level of coercion going on that doesn't
>show itself.
It's called context sensitivity. It's a very basic Perl concept, and a
useful feature!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Tue, 27 Mar 2007 00:07:08 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Behaviour when printing quoted ARRAY
Message-Id: <jvgg03ti1e72hi69c32ulu93pigedq9mq1@4ax.com>
On 26 Mar 2007 14:47:50 -0700, "Jorge" <awkster@yahoo.com> wrote:
>Understood -- I should have been looking more closely at the .
>operator to explain the coercion to scalar context -- not so much the
>quotes themselves. Subtle stuff.
Not too much. Expect to meet much subtler issues! ;-)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 26 Mar 2007 15:26:51 -0700
From: "Jorge" <awkster@yahoo.com>
Subject: Re: Behaviour when printing quoted ARRAY
Message-Id: <1174948011.861417.15150@d57g2000hsg.googlegroups.com>
On Mar 26, 3:07 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On 26 Mar 2007 14:47:50 -0700, "Jorge" <awks...@yahoo.com> wrote:
>
> >Understood -- I should have been looking more closely at the .
> >operator to explain the coercion to scalar context -- not so much the
> >quotes themselves. Subtle stuff.
>
> Not too much. Expect to meet much subtler issues! ;-)
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
Very helpful replies -- thanks much.
------------------------------
Date: 26 Mar 2007 22:46:24 -0700
From: krakle@visto.com
Subject: Re: CGI URL Redirect
Message-Id: <1174974384.874519.112100@b75g2000hsg.googlegroups.com>
On Mar 22, 3:33 pm, - Bob - <uctra...@ultranet.com> wrote:
> I'm familiar with using this raw statement to cause a redirect via a
> CGI:
>
> print "Location:http://www.someplace.yyy\n\n";
>
> Is there a more modern way I should be doing it now. Something
> built-in and/or more object oriented?
>
> Thanks,
You could use CGI.pm
my $cgi = new CGI;
print $cgi->redirect("http://www.yahoo.com");
But really, it's still printing the standard redirect header (which
hasn't changed since the beginning of HTTP)...
There's not a "modern" way because it has never changed.
------------------------------
Date: 27 Mar 2007 00:09:58 -0700
From: "490" <findingAri@gmail.com>
Subject: Changing one array affects the other
Message-Id: <1174979398.624626.233290@n59g2000hsh.googlegroups.com>
I have a strange problem.
There is a template that I want to use for a few arrays.
But in one array I want to change one of the parameters in the
anonymous hash thats inside the array, but when I change the hash in
arrTwo then arrOne also changes.
Why is that!?
#Script begins
my @Template = (
{
name => "Person",
params => []
},
{
name => "Doggi",
params => []
}
);
@arrOne = @Template;
#Print array before changing the Other array
print $arrOne[1]->{name} . "\n";
my @arrTwo = @Template;
$arrTwo[1]->{params} = [['John','doe']];
$arrTwo[1]->{name} = "This does not work well!!!!";
#Print array after changing the Other array
print $arrOne[1]->{name} . "\n";
#Script ends
The script returns:
Doggi
This does not work well!!!!
instead of Doggi twice.
Thanks!
------------------------------
Date: Tue, 27 Mar 2007 03:47:03 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Changing one array affects the other
Message-Id: <m2fy7r2knc.fsf@local.wv-www.com>
"490" <findingAri@gmail.com> writes:
> I have a strange problem.
> There is a template that I want to use for a few arrays.
>
> But in one array I want to change one of the parameters in the
> anonymous hash thats inside the array, but when I change the hash in
> arrTwo then arrOne also changes.
> Why is that!?
Assigning an array does a "shallow" copy, not a "deep" copy. You take an
array with two references in it, assign it to another array, and you get
a copy of those two references. But that's where it stops - the hashes
referred to by those refs are *not* copied, so the refs in the new array
will still refer to the same hashes that the refs in the first one do.
To do a deep copy, see the Storable module's dclone() function.
For further reading, have a look at Randal's Feb 2000 Unix Review column:
<http://www.stonehenge.com/merlyn/UnixReview/col30.html>
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Tue, 27 Mar 2007 12:23:58 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: Changing one array affects the other
Message-Id: <y18Oh.15608$PL.7881@newsread4.news.pas.earthlink.net>
On 03/27/2007 02:09 AM, 490 wrote:
> I have a strange problem.
> There is a template that I want to use for a few arrays.
>
> But in one array I want to change one of the parameters in the
> anonymous hash thats inside the array, but when I change the hash in
> arrTwo then arrOne also changes.
> Why is that!?
>
> #Script begins
> my @Template = (
> {
> name => "Person",
> params => []
> },
> {
> name => "Doggi",
> params => []
> }
> );
>
> @arrOne = @Template;
>
>
> #Print array before changing the Other array
> print $arrOne[1]->{name} . "\n";
>
> my @arrTwo = @Template;
> $arrTwo[1]->{params} = [['John','doe']];
> $arrTwo[1]->{name} = "This does not work well!!!!";
>
> #Print array after changing the Other array
> print $arrOne[1]->{name} . "\n";
>
> #Script ends
>
> The script returns:
> Doggi
> This does not work well!!!!
>
> instead of Doggi twice.
>
> Thanks!
>
It's because @arrOne contains references to the hashes in @Template; the
elements of @arrOne and the elements of @Template both refer to the same
hashes.
What you want to do is to create a "deep copy" (or clone) of the @Template:
use Storable qw(dclone);
my @arrOne = @{dclone(\@Template)};
Read about references and cloning:
perldoc perlref
perldoc Storable
I hope this helps.
------------------------------
Date: Mon, 26 Mar 2007 20:49:08 GMT
From: "BradenM - Sonoma Computer" <BradenM@SonomaComputer.com>
Subject: Creating empty variables for input data
Message-Id: <8lWNh.2754$u03.1226@newssvr21.news.prodigy.net>
Hello;
I am creating a script that will be taking data from a POST and submitting
the data to variables which are placed within a hash for string to data
association. Then, using HTML::Table and Mail::Sendmail, the data is parsed
into an html table and then an email is created and send to a recipient.
So, my question is this; How do I take the input from a post form and have
the variables pick up the data and process it into a hash?
my $name = ;
my $instock = ;
my describe = ;
# Hash to hold inventory data
my %table_data = (
model => '$modelnumber',
item => '$name',
available => '$instock',
description => '$describe',
);
This is all the code I have written thus far, any pointers or suggestions
for this project?
------------------------------
Date: Mon, 26 Mar 2007 17:29:54 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Creating empty variables for input data
Message-Id: <m27it366ct.fsf@local.wv-www.com>
"BradenM - Sonoma Computer" <BradenM@SonomaComputer.com> writes:
> So, my question is this; How do I take the input from a post form and have
> the variables pick up the data and process it into a hash?
Have a look at the CGI module docs, specifically the section titled "Fetching
the parameter list as a hash." Briefly:
my $query = new CGI;
my %vars = $query->Vars;
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Tue, 27 Mar 2007 00:09:58 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Creating empty variables for input data
Message-Id: <12hg03ddqjieeagtgaabs3b4hmeb6d5v9v@4ax.com>
On Mon, 26 Mar 2007 20:49:08 GMT, "BradenM - Sonoma Computer"
<BradenM@SonomaComputer.com> wrote:
>my $name = ;
>my $instock = ;
>my describe = ;
(Syntax error) x 3;
># Hash to hold inventory data
>my %table_data = (
> model => '$modelnumber',
> item => '$name',
> available => '$instock',
> description => '$describe',
You may actually want this, but more probably, just
model => $modelnumber,
>This is all the code I have written thus far, any pointers or suggestions
>for this project?
How 'bout: learn some *basic* Perl?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 26 Mar 2007 18:35:11 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Creating empty variables for input data
Message-Id: <m2wt134ork.fsf@local.wv-www.com>
Michele Dondi <bik.mido@tiscalinet.it> writes:
> How 'bout: learn some *basic* Perl?
What's that, Perl with line numbers, capital letters, and "let"?
10 LET MY MESSAGE$ = "Just another BASIC PERL hacker!\n";
20 GOTO 20;
There's an ACME:: module in there somewhere... :-)
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Mon, 26 Mar 2007 15:05:35 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Encrypting long passwords
Message-Id: <eu8gm6$889$1@nntp.fujitsu-siemens.com>
TheDeerHunter wrote:
> Now I actually tried it - and I do see that Crypt::PasswdMD5 does the
> job and creates encrypted strings that are sensitive to length of
> input string greated than 8.
>=20
> Again, thanks for the tip.
>=20
You're welcome. Sorry if my response was a little too rough. I tend to=20
get carried away, lately. Need to adjust my medication ;-)
Josef
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Mon, 26 Mar 2007 15:36:23 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Encrypting long passwords
Message-Id: <1pif03t90bm04d6hh5bqn6smdcc7rq83bg@4ax.com>
On 26 Mar 2007 04:48:50 -0700, "TheDeerHunter"
<David.Hiskiyahu@alcatel-lucent.be> wrote:
>There is a known limitation in the Perl 'crypt' function - the result
>of
>a call to crypt is sensitive only to the first eight characters of the
>encrypted string.
Nope, AIUI it is a wrapper around the C-library-shipped crypt() and if
the latter supports longer pw's then so will do perl's one.
campari:~ [15:36:29]$ perl -le 'print for map {crypt $_,
q/$1$foobar/} qw/very_long_string very_long_string2/'
$1$foobar$s/Egu8qvYunAIubMizsV6.
$1$foobar$Q00ez7xgTnRCxyUqTAHBc1
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 26 Mar 2007 07:35:47 -0700
From: "bytebro" <keith.willis@aah.co.uk>
Subject: Re: Encrypting long passwords
Message-Id: <1174919747.756991.166100@l77g2000hsb.googlegroups.com>
On 26 Mar, 12:59, Josef Moellers <josef.moell...@fujitsu-siemens.com>
wrote:
> TheDeerHunter wrote:
> > There is a known limitation in the Perl 'crypt' function - the result
> > of
> > a call to crypt is sensitive only to the first eight characters of the
> > encrypted string.
> > Can someone recommend a Perl module that would be useful
> > to implement encryption of long passwords, in such way that
> > the result of the two calls above would differ?
>
> > Strength similar to that of crypt or better is OK.
>
> Look Ma, I can use google: "perl encrypt password"
> First hit contains "Crypt::PasswdMD5", go to CPAn, find Crypt-PasswdMD5-1.3
Strictly speaking, that will not 'encrypt' the password/phrase, it
will hash it. A hash is one-way, whereas encryption is reversible.
BTW, if a hash is what the OP needs, MD5 is pretty much considered
'broken' these days; most crypto-dudes are recommending SHA2 for new
stuff. For reversible encryption, it's AES. There are modules on
CPAN for each.
------------------------------
Date: Mon, 26 Mar 2007 16:47:44 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Encrypting long passwords
Message-Id: <e7nf035uc5i1dclsjin9g44ufb7p8iferv@4ax.com>
On 26 Mar 2007 05:41:13 -0700, "TheDeerHunter"
<David.Hiskiyahu@alcatel-lucent.be> wrote:
>Now I actually tried it - and I do see that Crypt::PasswdMD5 does the
>job and creates encrypted strings that are sensitive to length of
>input string greated than 8.
As I wrote in my other post, chances are plain old crypt() will do the
same, if you feed it a suitable salt.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 267
**************************************