Well, i'll continue making assumptions ...
The system you want (if it is what i think) is like this:
- An user wants to authenticate. He or she introduces his name and password into some formulary
- Pass this data to your perl script/function/whatever
- It takes the generic encrypted pasword for this user (looking this at the indexed file)
- It deciphers it with your generic 56byte-key stored at ~/a.conf
- Then it takes from the other file the user encrypted password
- Decrypts this password whit the decrypted key for this user
- Finally compares if the dechipered password is equal to the password passed as argument
If this is you want to do; why do not reuse (modern Unixes|GNU/Linux) way? ... I mean:
- user introduces username and password.
- user the function/script get a stream of bytes (generated by a hash function (a.k.a. one way function) like the md5, sha1, etc ... if you want, you can generate the hash using some password) from the password. If you use a web formulary, you must consider that the user password will travel unciphered accross the net and a possible eavesdropper attack can be done against this user :-P.
- The script takes with the user identifier the diggest/hashed/md5ed password from the indexed file (this time we only need one file)
- compares it with the current 'hashed password'. If they are equal, the passwords (in plain text) are equal (in theory), so the authentication is done.
MD5 algorithm is commonly used for getting these digests. Yes, md5 is not very secure, but there are other hash functions you can use (Digest::MD5, Digest::SHA1) ...
I recommend you to search on Bruce Scheneier site for a recommedation on what hash/digest algoritm to use ...
regards
turo
perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.