1 file = 2 different md5 strings???

The place for "I can't figure out how to..." questions.
Post Reply
milius.net
User
Posts: 16
Joined: Thu Feb 02, 2006 3:19 pm

1 file = 2 different md5 strings???

Post by milius.net » Mon Feb 27, 2006 6:44 pm

hello,

why am I getting 2 different md5 strings with the following code

Code: Select all

		$fileinformation['md5_file'] = md5($filename);
		echo "1: " . $fileinformation['md5_file'];

		$fileinformation['md5_file']  = getid3_lib::md5_file($filename);
		echo "2: " . $fileinformation['md5_file'];

aren't they supposed to be equal?

Allan Hansen
getID3() v2 developer
Posts: 445
Joined: Sun May 04, 2003 2:22 pm
Location: Holmegaard, Denmark

Post by Allan Hansen » Mon Feb 27, 2006 9:57 pm

Because the php function md5() works on a string, while getid3_lib::md5_file) calls the php function md5_file(), which works on a file.

milius.net
User
Posts: 16
Joined: Thu Feb 02, 2006 3:19 pm

Post by milius.net » Wed Mar 01, 2006 12:50 pm

thank you very much for answering, allen, I do understand the difference now - just one more question:
Allan Hansen wrote:Because the php function md5() works on a string,
which/what string is it the php md5() string works on?

Allan Hansen
getID3() v2 developer
Posts: 445
Joined: Sun May 04, 2003 2:22 pm
Location: Holmegaard, Denmark

Post by Allan Hansen » Thu Mar 02, 2006 10:00 am

md5('this is a string - not a filename')
md5_file('/path/to/file.ext')

Post Reply