Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

md5_file(3) [php man page]

MD5_FILE(3)								 1							       MD5_FILE(3)

md5_file - Calculates the md5 hash of a given file

SYNOPSIS
string md5_file (string $filename, [bool $raw_output = false]) DESCRIPTION
Calculates the MD5 hash of the file specified by the $filename parameter using the RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. The hash is a 32-character hexadecimal number. PARAMETERS
o $filename - The filename o $raw_output - When TRUE, returns the digest in raw binary format with a length of 16. RETURN VALUES
Returns a string on success, FALSE otherwise. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.1.0 | | | | | | | Changed the function to use the streams API. It | | | means that you can use it with wrappers, like | | | md5_file('http://example.com/..') | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 Usage example of md5_file(3) <?php $file = 'php-5.3.0alpha2-Win32-VC9-x64.zip'; echo 'MD5 file hash of ' . $file . ': ' . md5_file($file); ?> SEE ALSO
md5(3), sha1_file(3), crc32(3). PHP Documentation Group MD5_FILE(3)

Check Out this Related Man Page

SHA1_FILE(3)								 1							      SHA1_FILE(3)

sha1_file - Calculate the sha1 hash of a file

SYNOPSIS
string sha1_file (string $filename, [bool $raw_output = false]) DESCRIPTION
Calculates the sha1 hash of the file specified by $filename using the US Secure Hash Algorithm 1, and returns that hash. The hash is a 40-character hexadecimal number. PARAMETERS
o $filename - The filename of the file to hash. o $raw_output - When TRUE, returns the digest in raw binary format with a length of 20. RETURN VALUES
Returns a string on success, FALSE otherwise. EXAMPLES
Example #1 sha1_file(3) example <?php foreach(glob('/home/Kalle/myproject/*.php') as $ent) { if(is_dir($ent)) { continue; } echo $ent . ' (SHA1: ' . sha1_file($ent) . ')', PHP_EOL; } ?> CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.1.0 | | | | | | | Changed the function to use the streams API. It | | | means that you can use it with wrappers, like | | | sha1_file('http://example.com/..') | | | | +--------+---------------------------------------------------+ SEE ALSO
sha1(3), md5_file(3), crc32(3). PHP Documentation Group SHA1_FILE(3)
Man Page

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Md5

Does anyone know a scipt that includes MD5. I need to run a script that includes MD5 encryption. Thanks (1 Reply)
Discussion started by: duncang3
1 Replies

2. Programming

md5 hash a string or char array in SCO

Can someone provide me with code to md5 hash a string or character array in the SCO environment. All help is appreciated thanks. (5 Replies)
Discussion started by: jcarter2333
5 Replies

3. Programming

MD5 hash calculation

hi i want to generate MD5 hash of string in unix (hp) i have the algorithm which takes file as argument and returns hash of file but when i tried to generate hash of "a" result was "60b725f10c9c85c70d97880dfe8191b3" hash but actually it should have been "0cc175b9c0f1b6a831c399e269772661" now i... (4 Replies)
Discussion started by: zedex
4 Replies

4. Shell Programming and Scripting

MD5 hash filename

I am a newbie to shell programming. Can someone help me with the following ? Shell script that accomplishes the following - # Step 1 List all files in the directory # Step 2 Loop through each filename say a.htm and MD5 hash the filename to say b.htm # Step 3 copy a.htm to b.htm # Step 4... (1 Reply)
Discussion started by: bebar
1 Replies

5. UNIX for Dummies Questions & Answers

How to convert MD5 hash into shadow format?

I am trying to use John the Ripper but it doesn't take regular MD5 hashes, only shadow MD5 hashes. For example this hash: 900150983cd24fb0d6963f7d28e17f72 (which, decrypted, is 'abc') within a text file, John the Ripper does not detect because it is not in shadow format. How can I convert this MD5... (2 Replies)
Discussion started by: guitarscn
2 Replies

6. Shell Programming and Scripting

Md5sum is running very slowly

Hi, I am trying to get the hash values of md5 of a string. I am on Redhat Linux. using the 25-27 field in the file I need to generate the md5 and append it at the end of the record as a new field. I have tried the below code but its painfully slow. can you please suggest any alternatives or... (21 Replies)
Discussion started by: ahmedwaseem2000
21 Replies

7. Shell Programming and Scripting

Perl giving unexpected md5 hash values

I am trying to speed up creating a line by line hash file from a huge file using Perl. Here is my current (working but too slow) Bash code: (while read line; do hash=$(echo -n $line | md5sum); echo ${hash:0:32}; done)And here is my Perl code: perl -MDigest::MD5 -le 'foreach $line ( <STDIN> )... (3 Replies)
Discussion started by: Michael Stora
3 Replies

8. Shell Programming and Scripting

Apply md5 hash to a field in csv file

I have a .csv file and I want to md5 hash the second column for each row in the file. File is something like data1,foobar1,123,345 data2,foobar2,456,9393 data3,foobar3,1002,10109 Output would be like data1,6c81243028f8e455fa617dd5f0232ce1,123,345... (3 Replies)
Discussion started by: jjwags
3 Replies

9. Shell Programming and Scripting

Checking MD5 Hashes on a folder tree

Hi Guys, I have a backup program that creates incremental backups and generates a MD5 hash at the same time. Each server backup has its own sub folder. Each backup file has a corresponding .md5 file containing a hash and a file name like this. 3410efed13b087322de8036145230a55... (6 Replies)
Discussion started by: Pollardd
6 Replies