c# - Different hash after relog -



have strange problem c# application. basicaly, creating client <-> server application send pdf files. want add md5 checksum security prevent unnecessary retransmissions. here md5 hasher:

public static class cardfingerprint {     static md5 md5;      static cardfingerprint()     {         md5 = md5.create();     }      public static string computefingerprint(string pathtofile)     {         byte[] hash = null;          using (var stream = file.openread(pathtofile))         {             hash = md5.computehash(stream);         }          return bitconverter.tostring(hash).replace("-", string.empty);     } } 

here code file receive, basicaly tcpclient byte transmission:

        filereceiverstatus status = filereceiver.recievefile(packetstorecieve);         string fingerprint = cardfingerprint.computefingerprint(status.downloadedfile); 

everyting works fine, when log system , send file 2 times i'll get:

[ 06.01.2016 - 01:46:52 ] >> user: dell-ikaros sending file. [ 06.01.2016 - 01:46:53 ] >> dell-ikaros: file card_06012016_014653_9c93.pdf downloaded. [ 06.01.2016 - 01:46:53 ] >> hash: 810e10b2770d2c3f89f89cad9515567c [ 06.01.2016 - 01:46:57 ] >> user: dell-ikaros sending file. [ 06.01.2016 - 01:46:58 ] >> dell-ikaros: file card_06012016_014658_fb78.pdf downloaded. [ 06.01.2016 - 01:46:58 ] >> hash: 810e10b2770d2c3f89f89cad9515567c [ 06.01.2016 - 01:46:58 ] >> dell-ikaros: file duplication - controll sum: 810e10b2770d2c3f89f89cad9515567c 

but!! when log off , log in again, , send same file before ill get:

[ 06.01.2016 - 01:47:13 ] >> user: dell-ikaros log out. [ 06.01.2016 - 01:47:16 ] >> user: dell-ikaros log in. [ 06.01.2016 - 01:47:23 ] >> user: dell-ikaros sending file. [ 06.01.2016 - 01:47:23 ] >> dell-ikaros: file card_06012016_014723_7b15.pdf downloaded. [ 06.01.2016 - 01:47:23 ] >> hash: b9c755b78472b71dd9d230c94cef8fa6 

what going on?? clues might wrong? downlaoded files have same numbers of bytes, there shouldn't difference except file name... seems there slighty difference have no idea why , where, if there problem in tcpclient downloader, md5 should different, problem occurs after relog.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -