# NatAntBuild Cache properties file - Hash value

**URL:** <https://techcommunity.softwareag.com/t/natantbuild-cache-properties-file-hash-value/243502>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes, NaturalONE\
**Created:** [August 10, 2021, 10:38am UTC](https://techcommunity.softwareag.com/t/natantbuild-cache-properties-file-hash-value/243502 "2021-08-10T10:38:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trentan\_Healey](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/trentan_healey/32/7009_2.png) [@Trentan\_Healey](https://techcommunity.softwareag.com/u/Trentan_Healey)\
**Post date:** [August 10, 2021, 10:38am UTC](https://techcommunity.softwareag.com/t/natantbuild-cache-properties-file-hash-value/243502/1 "2021-08-10T10:38:25Z")

</div>

Hi all, interesting scenario here (and probably relevant as more sites transition to straight NaturalOne usage)

For the **Hash Value** in the  
Natural Ant build _cache\_xxx.properties_ file

How is the hash value for the modules generated?

I say this, as there may be developers who are working in an ‘old’ style (Natural Studio / MF Editor), and rather then clobber their change with a redeploy (stow/cat) - I would rather ignore the rogue modules and leave it be - update the value in the cache properties file (to match the server version / updated from base library version) so it does not deploy.

I have been overcoming this problem in the past by running a Natural Ant Deploy without Stow or Upload on (to update the hash values).

For all those interested, It is easy to identify the modules intended for deployment (without performing the deploy) with the ‘checkts’ argument in the Natural Ant Deploy.

Unfortunately, unless everybody in a team is using modern ways of working (Git, NaturalOne, Jenkins) - there would be many sites with similar issues.

---

<div class="post-metadata">

**Author:** ![Thomas\_Schwade](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/thomas_schwade/32/131_2.png) [@Thomas\_Schwade](https://techcommunity.softwareag.com/u/Thomas_Schwade)\
**Post date:** [August 17, 2021, 11:41am UTC](https://techcommunity.softwareag.com/t/natantbuild-cache-properties-file-hash-value/243502/2 "2021-08-17T11:41:46Z")

</div>

The following sample code should do the job:

```auto
	public String getHash(String str) {
		String hash = null;
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			byte[] array = md.digest(str.getBytes());
			StringBuffer sb = new StringBuffer();
			for (int i = 0; i < array.length; ++i) {
				sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100)
						.substring(1, 3));
			}
			hash = sb.toString();
		} catch (NoSuchAlgorithmException e) {
			System.out.println("Could not calculate MD5 hash");
			e.printStackTrace();
		}
		return hash;
	}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [November 15, 2021, 11:42am UTC](https://techcommunity.softwareag.com/t/natantbuild-cache-properties-file-hash-value/243502/3 "2021-11-15T11:42:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
