Libsodium has some helpers, which allow hexdecimal decoding, encoding and also constant-time string comparison.
So if you use the php binding libsodium-php
you obviously also have the native php implementation of bin2hex
and hex2bin
. The libsodium replacements were introduced because the native implementations are not timing-resistent. So for sensitive data this should be used.
But if you have a library/project where you use libsodium anyway are there any disadvantages of using libsodiums functions even in places where this would not be necessary?
I mean one advantage clearly would that you can prevent to forget to use these timing-save implementations in cases where it is important if you just use it everywhere.