# Compare binary files

**URL:** <https://forum.ansible.com/t/compare-binary-files/13191>\
**Category:** Ansible Project\
**Created:** [July 25, 2013, 3:11am UTC](https://forum.ansible.com/t/compare-binary-files/13191 "2013-07-25T03:11:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [July 25, 2013, 3:11am UTC](https://forum.ansible.com/t/compare-binary-files/13191/1 "2013-07-25T03:11:27Z")

</div>

Hi, I wish to compare between 2 binary files.

action: copy src = {{srcLocation}} dest={{destLocation}}

–check --diff.

This works well if the 2 binaries are of different sizes. If they are of the same sizes but has different content, ansible shows it as ok, meaning no diff between the 2 files.

Is ansible able to compare two different binary files when they have the same file size?

Thank you.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 25, 2013, 6:43am UTC](https://forum.ansible.com/t/compare-binary-files/13191/2 "2013-07-25T06:43:39Z")

</div>

–diff is really only usable for basic things.

I would register a checksum instead.

---

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [July 25, 2013, 8:58am UTC](https://forum.ansible.com/t/compare-binary-files/13191/3 "2013-07-25T08:58:02Z")

</div>

Thank you for the reply.

Can you guide me on the usage of checksum? i am unable to find much documentation on checksum.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 25, 2013, 2:04pm UTC](https://forum.ansible.com/t/compare-binary-files/13191/4 "2013-07-25T14:04:53Z")

</div>

I would look up the “register” keyword in Ansible and just call md5.

[http://www.ansibleworks.com/docs/playbooks2.html#register-variables](http://www.ansibleworks.com/docs/playbooks2.html#register-variables)
