Re: splitting text that contains an encrypted value
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Fri, 28 Apr 2006 12:37:24 -0700
Rance Hall wrote:
here is the prelim setup:
my $delimiter = ";;;";
my $teststring = "name;;;encryptedpassword;;;date";
my @userdetails = split($delimiter, $teststring);
here is the goal:
I would like to find a delimiter value that I can use to both create and
read from a flat-file database where splitting on the $delimiter doesn't
improperly split either the encryptedpassword value, or a reasonable
date format.
Question:
What would a good value for $delimiter be?
Ive got an idea that my three semicolon approach is not going to stand
up to all possible password encryption schemes, so I probably need
something more bullet proof than this.
Three things that may work:
1. Convert the password field to a character set that does not conflict with
the delimiter (like passwd(5) does.)
2. Put the password field at the end of the line. For example:
my $teststring = 'name;date;encryptedpassword';
my @userdetails = split /$delimiter/, $teststring, 3;
3. Use fixed length fields. For example:
my $teststring = pack 'a20 a30 a8', 'name', 'encryptedpassword', 'date';
my @userdetails = unpack 'a20 a30 a8', $teststring;
John
--
use Perl;
program
fulfillment
.
- Follow-Ups:
- Re: splitting text that contains an encrypted value
- From: usenet
- Re: splitting text that contains an encrypted value
- References:
- splitting text that contains an encrypted value
- From: Rance Hall
- splitting text that contains an encrypted value
- Prev by Date: Re: splitting text that contains an encrypted value
- Next by Date: Re: Portal Authentication
- Previous by thread: Re: splitting text that contains an encrypted value
- Next by thread: Re: splitting text that contains an encrypted value
- Index(es):
Relevant Pages
|
|