byte_equal(3)

πŸ“¦
version 0.34 Β· 3 versions
, in alpine 3.24, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu resolute, ubuntu stonking

πŸ¦‹ byte_equal(3) πŸ¦‹

okay bestie, welcome to the Library Functions Manual page for byte_equal(3) β€” she's a tiny little function with main character energy, and she has ONE job: comparing two strings. let's get into it πŸ’…


✨ NAME ✨

byte_equal β€” compare two strings 🫢


🌸 SYNTAX 🌸

#include <libowfat/byte.h>

int byte_equal(const char *one,size_t len,const char *two);

like, that's the whole vibe. include the header, call the function, boom. ⭐


πŸ’– DESCRIPTION πŸ’–

so byte_equal returns 1 if the strings are equal, and 0 otherwise. that's it, that's the tea. πŸ“

BUT here's the part you actually need to know, bestie, because it's giving important: when the strings are different, byte_equal does not read bytes past the first difference. so it stops the second it finds a mismatch. lowkey efficient, highkey a problem depending on what you're doing. πŸ‘€

the way that an attacker observing the execution timing can learn where the first mismatch happened?? yeah. that's a real thing. the time it takes leaks info, and that's not the vibe you want for secrets. πŸ’€

so if you're comparing keys, passphrases, cookies or hashes β€” do NOT use byte_equal, okay?? use byte_equal_notimingattack instead. periodt. πŸ”₯

πŸŽ€ SEE ALSO πŸŽ€


okay that's the whole page, bestie!! tysm for reading, you ate that. this was the byte_equal(3) manual page, mwah πŸ’–βœ¨πŸŒˆ bye bye πŸ¦‹πŸ’