Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 594 Bytes

hash.md

File metadata and controls

36 lines (27 loc) · 594 Bytes

php

md5

md5(file_get_contents('http://example.com/some-file.html');
md5_file('http://example.com/some-file.html');

ed2k

echo hash_file('md4', 'example.txt');

incremental hashing

$fp = fopen($file, "r");
$ctx = hash_init('sha1');
while (!feof($fp)) {
    $buffer = fgets($fp, 65536);
    hash_update($ctx, $buffer);
}
$hash = hash_final($ctx);
fclose($fp);

shell

curl -sL http://example.com/some-file.html | md5sum
wget http://example.com/some-file.html -O- | md5sum

https://askubuntu.com/questions/685775/bash-get-md5-of-online-file