private String calcSHA1(final File f)
	{
		MessageDigest hashDigester = null;
		FileInputStream readFileStream;
		StringBuffer sha1StringBuffer = null;
		try {
			hashDigester = MessageDigest.getInstance("SHA-1");
			readFileStream = new FileInputStream(f);
			int n = 0;
			final byte[] buffer = new byte[8192];
			while (n != -1) {
				n = readFileStream.read(buffer);
				if (n > 0) {
					hashDigester.update(buffer, 0, n);
				}
			}
			readFileStream.close();

			final byte[] mdbytes = hashDigester.digest();

			// convert the byte to hex format
			sha1StringBuffer = new StringBuffer();
			for (final byte mdbyte : mdbytes) {
				sha1StringBuffer.append(Integer.toString(
						(mdbyte & 0xff) + 0x100, 16).substring(1));
			}
		} catch (final NoSuchAlgorithmException e) {
			e.printStackTrace();
		} catch (final FileNotFoundException e) {
			e.printStackTrace();
		} catch (final IOException e) {
			e.printStackTrace();
		}
		return sha1StringBuffer.toString();
	}