diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-01 17:45:39 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-01 17:45:39 +0200 |
| commit | adfa8e1265f6155d1a582baa9929af198bb5d4de (patch) | |
| tree | e3cee62aa5a8768621cd294295f787b8cc54141b /librecrypt_equal_binary.c | |
| parent | Add librecrypt.7 and README (diff) | |
| download | librecrypt-adfa8e1265f6155d1a582baa9929af198bb5d4de.tar.gz librecrypt-adfa8e1265f6155d1a582baa9929af198bb5d4de.tar.bz2 librecrypt-adfa8e1265f6155d1a582baa9929af198bb5d4de.tar.xz | |
Misc
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | librecrypt_equal_binary.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/librecrypt_equal_binary.c b/librecrypt_equal_binary.c index e1d17cd..21d9224 100644 --- a/librecrypt_equal_binary.c +++ b/librecrypt_equal_binary.c @@ -30,9 +30,12 @@ librecrypt_equal_binary(const void *a, const void *b, size_t len) size_t i; unsigned char r = 0u; + /* For each character pair XOR is zero on and only on equality, + * bitwise OR of all XORs remain 0 if and only if all where equal */ for (i = 0u; i < len; i++) r = (unsigned char)(r | (*x++ ^ *y++)); + /* Prevent compiler from returning early */ (*librecrypt_explicit_____)(r); return r ? 0 : 1; |
