# Formula to calculate app-hash

**URL:** <https://community.particle.io/t/formula-to-calculate-app-hash/30294>\
**Category:** General\
**Created:** [March 8, 2017, 12:31pm UTC](https://community.particle.io/t/formula-to-calculate-app-hash/30294 "2017-03-08T12:31:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gkujawsk](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gkujawsk/32/23621_2.png) [@gkujawsk](https://community.particle.io/u/gkujawsk)\
**Post date:** [March 8, 2017, 12:31pm UTC](https://community.particle.io/t/formula-to-calculate-app-hash/30294/1 "2017-03-08T12:31:12Z")

</div>

Guys,  
Basically I would like to check if the app firmware has  
been flashed properly. According to docs the app-hash  
seems to be a good fit. However, the formula to calculate  
the app-hash is nowhere to be found. Anybody can point  
me to the right direction?

[https://docs.particle.io/reference/api/#app-hash](https://docs.particle.io/reference/api/#app-hash)

–  
/G

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [March 8, 2017, 1:56pm UTC](https://community.particle.io/t/formula-to-calculate-app-hash/30294/2 "2017-03-08T13:56:08Z")

</div>

@gkujawsk, the system firmware does all this work for you and won’t flash a non-valid image. Any reason you want to double check?

---

<div class="post-metadata">

**Author:** ![gkujawsk](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gkujawsk/32/23621_2.png) [@gkujawsk](https://community.particle.io/u/gkujawsk)\
**Post date:** [March 8, 2017, 7:43pm UTC](https://community.particle.io/t/formula-to-calculate-app-hash/30294/3 "2017-03-08T19:43:24Z")

</div>

I wondered what’s the purpose of app-hash published by the cloud after the successful flashing.  
One of my ideas was that it somehow relates to the binary and can be used for verification.

Documentation says that “this hash can help confirm a flash succeeded and your new app is running, and also help you track exactly which version of which app is running on your device.”

How can app-hash actually confirm that a flash succeeded and help track version/app?

–  
/G

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [March 8, 2017, 8:07pm UTC](https://community.particle.io/t/formula-to-calculate-app-hash/30294/4 "2017-03-08T20:07:43Z")

</div>

Ping @Dave

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [March 8, 2017, 8:36pm UTC](https://community.particle.io/t/formula-to-calculate-app-hash/30294/5 "2017-03-08T20:36:11Z")

</div>

> [@gkujawsk](#):
>
> Documentation says that "this hash can help confirm a flash succeeded and your new app is running, and also help you track exactly which version of which app is running on your device."

AFAIK, the comfirmation is the fact that you get that _app-hash event_ published. If the flash didn't succeede, the _event_ would _ **not** _ occure.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [March 8, 2017, 10:37pm UTC](https://community.particle.io/t/formula-to-calculate-app-hash/30294/6 "2017-03-08T22:37:56Z")

</div>

Heya!

The App hash is stored in the firmware metadata (you can read that using the BVR [https://github.com/spark/binary-version-reader](https://github.com/spark/binary-version-reader) ).

The cloud saves the hash of the firmware running on your device, and publishes an event when that hash changes, signifying that your device is running a new version of firmware. This can be a helpful way to confirm that multiple devices of yours are running a particular version of firmware. It also can be used to ensure the firmware arrived intact on the device before being run.

You could imagine a flash succeeding, but the platform being incorrect for that device, so the device might reject the new firmware. In this case the app hash wouldn’t change, and you could see your device was running a version other than what you sent, etc.

I hope that helps!

Thanks,  
David
