# Bringing up SipHash in HashAlgorithm

**URL:** <https://forum.p4.org/t/bringing-up-siphash-in-hashalgorithm/541>\
**Category:** P4 Dev\
**Created:** [November 20, 2022, 4:27pm UTC](https://forum.p4.org/t/bringing-up-siphash-in-hashalgorithm/541 "2022-11-20T16:27:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![srihari39](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@srihari39](https://forum.p4.org/u/srihari39)\
**Post date:** [November 20, 2022, 4:27pm UTC](https://forum.p4.org/t/bringing-up-siphash-in-hashalgorithm/541/1 "2022-11-20T16:27:20Z")

</div>

As for my use case need, I implemented SipHash in Cpp. I want to include this in the p4c such that the new programs written can access the SipHash algorithm directly, if wanted. The problem is, I registered the Hash in `register_hash` function in `calculations.cpp`. I made relevant changes in the p4c frontends, backends and in the behavioral-model folder. Even after updating the binaries of `p4c` and `p4c-bm2-ss`, I’m still unable to access the hash algorithm I implemented, and it throws the error unexpected algorithm. If any one of you has worked on implementing a hash function/algorithm, please guide me through the process so that it can be useful to the community too. If everything goes well and right, this siphash algorithm could be our contribution to the community too.

If anyone of you are keen, then we can follow up for further details.

Thanks in advance.

---

<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:** [November 20, 2022, 4:57pm UTC](https://forum.p4.org/t/bringing-up-siphash-in-hashalgorithm/541/2 "2022-11-20T16:57:32Z")

</div>

I believe I have already pointed you at this example in another forum, but I created a post here and will link to it here, in hopes that others can find it, if it helps them. I realize you may be looking for more interactive help with a p4lang/behavioral-model code expert.

> [@Demonstration of adding a new extern to BMv2 / behavioral-model](https://forum.p4.org/t/demonstration-of-adding-a-new-extern-to-bmv2-behavioral-model/542):
>
> This example does NOT have a control plane API, only a data plane API, but some may still find it useful if they ever want to extend BMv2 with a new extern, as an example to learn from. I am putting a link to it here since otherwise it could be difficult to find.

---

<div class="post-metadata">

**Author:** ![srihari39](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@srihari39](https://forum.p4.org/u/srihari39)\
**Post date:** [November 20, 2022, 5:28pm UTC](https://forum.p4.org/t/bringing-up-siphash-in-hashalgorithm/541/3 "2022-11-20T17:28:02Z")

</div>

Yes, andy, someone who developed a similar thing recently can definitely help me out super fast!  
But the comments show that those are outdated. Also, I commented on antoninbas reply and am still waiting for the reply. [Issue Comment](https://github.com/p4lang/behavioral-model/issues/1153#issuecomment-1316479686)
