hash - The same content file, the MD5 value is different -


as know,the md5 of 2 different files(even if contents same) different,just this:

[langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ ll total 16 drwxrwxr-x  7 langshiquan langshiquan 4096 mar 28 19:41 output drwxrwxr-x  3 langshiquan langshiquan 4096 mar 28 19:44 test -rw-rw-r--  1 langshiquan langshiquan  100 mar 28 19:54 test.sh -rw-rw-r--  1 langshiquan langshiquan   69 mar 28 19:48 test.sh~ [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ sh test.sh [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ md5sum output.tar 2b7f05590cd4c8665dd61bbf745bbeee  output.tar [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ sh test.sh [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ ll total 18212 drwxrwxr-x  7 langshiquan langshiquan     4096 mar 28 19:41 output -rw-rw-r--  1 langshiquan langshiquan 18606080 mar 28 19:54 output.tar drwxrwxr-x  3 langshiquan langshiquan     4096 mar 28 19:44 test -rw-rw-r--  1 langshiquan langshiquan      100 mar 28 19:54 test.sh -rw-rw-r--  1 langshiquan langshiquan       69 mar 28 19:48 test.sh~ [langshiquan@cp01-rdqa-dev002.cp01.baidu.com md5test]$ md5sum output.tar 3601eff99bc78198b152b04ca94c53d0  output.tar 

test.sh script shell :

#! bin/bash cp -rp output ./test/ echo "1" > ./test/output/a.txt tar -cf output.tar ./test/* -c ./ 

i searching long time on net. no use. please or try give ideas how achieve this.
q1.so think whether there hash function similar md5,(e.g.i call "hashstr") makes same "hashstr" files same contents different attributes.
q2.or when can make tar, how can exclude attributes of file make same md5?

thanks in advance.

if files same, hashes same. if attributes (rather file contents) different, need add attributes file before hashing. put attributes want include piece of text , add file. hash attributes + file single piece of data.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -