SHA1 Checksum is getting different for same file in both php and android
<p>I am generating the SHA1 key in both PHP and Android to verify the file. But I am getting different keys for both PHP and Android.</p>

<p>Android : </p>

<pre><code>  try {
        MessageDigest digest = MessageDigest.getInstance("SHA-1");
        byte[] buffer = new byte[65536]; 
        InputStream fis = new FileInputStream(downloadFile.getPath());
        int n = 0;
        while (n != -1) {
            n = fis.read(buffer);
            if (n &gt; 0) {
                digest.update(buffer, 0, n);
            }
        }
        fis.close();
        byte[] digestResult = digest.digest();
       log("CheckSum : " + byteArray2Hex(digestResult));
    } catch (Exception e) {
        log("Exception : " + e.getLocalizedMessage());
    }
</code></pre>

<p>PHP:</p>

<pre><code>echo ' \nSHA1 File hash of '. $filePath . ': ' . sha1_file($filePath);
</code></pre>

<p>Checksum Output:</p>

<p><strong>PHP SHA1 CheckSum     : e7a91cd4127149a230f3dcb5ae81605615d3e1be
Android SHA1 CheckSum : 19bcbd9d18a3880d2375bddb9181d75da3f32da0</strong></p>

<p>Can anyone help how to handle this.</p>