Käynnissä

Generate a global hash (sha256) of a folder (PHP language)

We have a series of sha256 hash (one for each file in a folder) and we would like to sum them to get a global hash (the hash of the folder).

The job is to create a PHP function that will sum two hash, we will take care of the rest.

For example, the script would receive two hashs :

9F C2 B3 99 E8 33 3A 3D 48 75 BD EA 6A CC 6A F5 8B 1F 73 9A 14 86 F2 BF 17 98 35 7A 4B CE A5 C0

and

85 A9 E3 86 B3 5D 5D F2 AD F1 B9 EC E5 7E 56 4C 1F B6 06 05 52 94 5F 6C 94 E9 33 E4 16 0C EF A1

and return the sum :

24 6C 97 20 9C 91 97 2F F6 66 77 D7 50 4B C1 41 AB D5 79 9F 66 1A 52 2C AC 81 69 5E 62 DA 94 62

(that's the valid result by the way, you can use this example to test your script)

Be careful, these are hexadecimal characters but the value is represented each time by two digits (16*16=base 256). I added space to better understand the logic behind it.

A few tips :

1) sum is "add" operation, not "xor" operation.

3) hex dump is not sequence of hex digits. It's sequence of bytes (two digits per byte):

85A9 doesn't mean 8 5 A 9. it means 85 A9.

3) the order is reverse: "least significant" byte is first.

The final goal is to reproduce what the 7zip tool does with its CRC-SHA256 feature but in PHP...

So we would get the exact same result, we want to have a global hash of an entire folder with many files.

Generating a zip is not an option, we really want the final result to be the combined hash.

A way to test it :

- Download 7zip with the extra hash features

- pick up two files... generate the sha256 of each file and also of a folder containing both files.

- use your script to sum both individual hash.... you should get the same result at the folder hash generated by 7zip.

It has to be done with PHP... and no extra library (but you can use bcmath or other standard php modules).

Taidot: PHP

Näytä lisää: translate php language file software, read delete file folder php code, php language selector, joomla global variables database external php, php language translation file, php language files translation, PHP language, php language chooser, php language files, php language translator class, php language translate script google, convert php language, php language translator mysql, php language translate lang enphp, easy translation php language files, hsbc php generate order hash

Tietoa työnantajasta:
( 1 arvostelu ) Lyon, France

Projektin tunnus: #29011504

3 freelanceria on tarjonnut keskimäärin €173 tähän työhön

asait1192

SIR “I can complete your project on time and within your budget.” I am Asait representing Skynet Global System ,Gujarat. We have group of inhouse group of 15 designers and we include conveyed 200 undertakings inside Lisää

€140 EUR 7 päivässä
(34 arvostelua)
6.3
stepanbohanov

⭐⭐⭐I can make php script for u⭐⭐⭐ Hi, dear client. I hope u a being well. I've read your proposal carefully and am getting interested in your project. I will prove my ability by implementing your requirments. You can Lisää

€180 EUR 3 päivässä
(39 arvostelua)
5.8
ibragim5555

Hi Adrien, I understood what you want. I am very specialized in PHP 5.x ~ 7.x. I have confidence that I can get the result done perfectly. So if you are interested in me, please contact to me anytime. I look forward to Lisää

€200 EUR 7 päivässä
(20 arvostelua)
5.0