# Incorrect output when using HashAlgorithm.crc16\_custom consecutive times

**URL:** <https://forum.p4.org/t/incorrect-output-when-using-hashalgorithm-crc16-custom-consecutive-times/741>\
**Category:** P4 Dev\
**Created:** [April 15, 2023, 6:12am UTC](https://forum.p4.org/t/incorrect-output-when-using-hashalgorithm-crc16-custom-consecutive-times/741 "2023-04-15T06:12:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cristina-dominicini](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@cristina-dominicini](https://forum.p4.org/u/cristina-dominicini)\
**Post date:** [April 15, 2023, 6:12am UTC](https://forum.p4.org/t/incorrect-output-when-using-hashalgorithm-crc16-custom-consecutive-times/741/1 "2023-04-15T06:12:42Z")

</div>

Dear all,

We have been using the bmv2 simple\_switch to test some research proposals that explore the hash operation with the HashAlgorithm.crc16\_custom algorithm.

Our most recent proposal needs to perform consecutive hash operations, but we are getting an incorrect output from the hash function if a custom CRC polynomial is configured.

For reproducing the issue, we extended a basic calculator from P4 tutorials: [GitHub - giancarloliver/hash-custom: hash-custom](https://github.com/giancarloliver/hash-custom)

This tutorial shows a simple example that reproduces the issue when executing consecutive hash operations with custom CRC.

Could you please help us to understand this behavior? Are we using the hash extern in an incorrect manner? Is it a bug in the simple\_switch library?

Thank you,  
Cristina Klippel Dominicini

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [May 28, 2023, 3:40am UTC](https://forum.p4.org/t/incorrect-output-when-using-hashalgorithm-crc16-custom-consecutive-times/741/2 "2023-05-28T03:40:29Z")

</div>

For anyone else that finds this question and wonders about a resolution, I believe the answer was arrived at here: [Incorrect output when using HashAlgorithm.crc16\_custom consecutive times · Issue #1192 · p4lang/behavioral-model · GitHub](https://github.com/p4lang/behavioral-model/issues/1192)
