sha1 


GENERATES a value designated as sha1, used to attest the DATA integrity, based on the US Secure Hash Algorithm 1.


sha1 is an INTEGRITY key based on RFC-3174.

Just like the md5, sha1 is designed to be fast and efficient.

Current equipment and modern techniques, become crucial elements for its breakage, if used as a cryptographic key, thus recommending its not being used as such.

It should be considered as a SIGNATURE that guarantees the INTEGRITY of a DATA.
   Password Hashing FAQ  !      US Secure Hash Algorithm 1 (SHA1)  !      National Security Agency  !      The MD5 Message-Digest Algorithm  !



 HASH 

A HASH function is any function that can be used to map data of arbitrary size to data of a fixed size.

The values returned by a HASH function are called HASH values, HASH codes, digests, or simply hashes.

HASH functions are often used in combination with a HASH table, a common data structure used in computer software for rapid data lookup.

HASH functions accelerate table or database lookup by detecting duplicated records in a large file.

One such application is finding similar stretches in DNA sequences.

They are also useful in cryptography.

A cryptographic HASH function allows one to easily verify that some input data maps to a given HASH value, but if the input data is unknown, it is deliberately difficult to reconstruct it, (or any equivalent alternatives), by knowing the stored HASH value.

This is used for assuring integrity of transmitted data, and is the building block for HMACs, which provide message authentication.

HASH functions are related to, (and often confused with), checksums, check digits, fingerprints, lossy compression, randomization functions, error-correcting codes, and ciphers.

Although the concepts overlap to some extent, each one has its own uses and requirements and is designed and optimized differently.

The HashKeeper database maintained by the American National Drug Intelligence Center, for instance, is more aptly described as a catalogue of file fingerprints than of HASH values.

From Wikipedia, the free encyclopedia.





This function integrates the cast of  standard  library functions.

Included in this section for being in common use.



<?php

str sha1 
str $str [, bool $raw_output FALSE ] )


where,

$str STRING to calculate the validation key

$raw_output 
To control the sha1 value output
                       
SEE the below TABLE )

?>

 $str 


STRING to calculate the sha1 validation key.



 $raw_output 

VALUE MEANING CHARACTERS
FALSE sha1 HASH HEXADECIMAL 40
TRUE sha1 HASH RAW BINARY 20
ed48


  1 EXERCISE   

<?php

$str2sha1 
"Love's not time's fool, though rosy lips and cheeks within his bending sickle's compass come; or bends with the remover to remove. Let me not to the marriage of true minds if this be error and upon me proved, oh, no, it is an ever fixed mark. Which alters when it alteration finds, it is the star to every wand'ring bark, admit impediments; love is not love.";

$strsha1H sha1($str2sha1);

$strsha1B sha1($str2sha1true);

echo 
'SHA1 - HASH HEX (40) =<br>' $strsha1H;

echo 
'<br><br>SHA1 - HASH BIN (20) =<br>' $strsha1B

?>

 RESULT   

SHA1 HASH - HEX (40)
df9709cb448db876020b051cdf2805ba71d41ed1

SHA1 HASH - BIN (20)
ߗ �D��v �(�q��