|
|
Tutorials

Perl

|
Topic |
What is crypt() in Perl?
|
|
Explanation |
|
This is used for 56 bit DES encryption,its a one way hash function. In the function
plain text and salt is converted into a digest. Small changes made to the plain text or salt will have a large change
in digest.
Syntax:
crypt (plaintext, salt)
In the above syntax, this function takes two arguments first argument is "plaintext", second one is
the "salt" value.
Example:
#! C:\programfiles\perl\bin\perl
print "content-type: text/html\n\n";
$string = "ABV.PNT4TtMZQ";
$string2 = "Hioxindia";
$temp = crypt($string,'AB');
if ($string=$string2)
{
print "Crypt Matches";
}
else
{
print "Crypt Dont Match";
}
Result:
Crypt Matches
In the above example already a string "Hioxindia", with the salt AB is encrypted and the digest is
stored in "$string", then the same string "Hioxindia" and salt is explicitly encrypted.It displays an "Crypt Matches".
|
|
A Note |
|
Simple introduction, basic CGI perl programming codes with examples.
Do send your feedback or suggestions on this tutorial.
This is a copyright content.
|
|
|
|