OPENSSL_STRCASECMP(3ossl)
π OPENSSL_STRCASECMP π
okay so bestie, this is the OPENSSL_STRCASECMP(3ossl) page from the OpenSSL manual, and we're about to make case-insensitive string comparison your whole personality. stay with me, it's gonna slay β¨
πΈ NAME πΈ
OPENSSL_strcasecmp, OPENSSL_strncasecmp β the girlies that compare two strings while fully ignoring case, no cap π
π SYNOPSIS π
#include <openssl/crypto.h>
int OPENSSL_strcasecmp(const char *s1, const char *s2);
int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);
π¦ DESCRIPTION π¦
so OPENSSL_strcasecmp does a byte-by-byte comparison of the strings s1 and s2, and the entire time it's ignoring the case of the characters. like, uppercase, lowercase, whatever β it does not care, it's not the vibe π
OPENSSL_strncasecmp is the exact same energy, except it compares no more than n bytes of s1 and s2. so it's got boundaries. iconic.
now here's the tea on locales β β in a POSIX-compatible system and on Windows, these functions use the "C" locale for case insensitivity. otherwise? the comparison is done in the current locale. so like, know which one you're in, iykyk π
π«Ά RETURN VALUES π«Ά
both functions return an integer that's either:
- less than zero if
s1is found to be less thans2π - equal to zero if
s1matchess2π - greater than zero if
s1is found to be greater thans2π₯
periodt, that's the whole return story.
β NOTES β
OpenSSL extensively uses case-insensitive comparison of ASCII strings. lots of it. constantly. it's a whole thing.
and here's where it gets messy π β even though OpenSSL itself is locale-agnostic, applications that use OpenSSL libraries may unpredictably suffer when they use localization. the classic example? the Turkish locale, which is famously known for its specific I/i cases. yeah. that one. π«
so these functions use the C locale for string comparison. safety first, bestie.
π HISTORY π
these functions were added in OpenSSL 3.0.3. so they're not ancient, they're just well-adjusted β¨
π COPYRIGHT π
copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
licensed under the Apache License 2.0 (the "License"). you may not use this file except in compliance with the License. you can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
π fr fr, read the license before you go copying stuff. it's giving legal, but make it cute.
and that's the whole page, bestie β 3.5.6, dated 2026-04-07, from the OpenSSL manual. go compare some strings, you absolute main character π§π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms