OPENSSL_STRCASECMP(3ossl)
π OPENSSL_STRCASECMP π
okay bestie, welcome to the 3ossl manual page for two lil functions that compare strings while completely ignoring the drama of uppercase vs lowercase. it's giving "we don't care about your shift key" energy and honestly? iconic. β¨
πΈ NAME πΈ
OPENSSL_strcasecmp, OPENSSL_strncasecmp β compare two strings ignoring case π₯
π 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 whole time it is ignoring the case of the characters. like, it literally does not care. not one bit. π
OPENSSL_strncasecmp is the same vibe, except it compares no more than n bytes of s1 and s2. that's the only difference, periodt. π«Ά
now the locale tea β: on a POSIX-compatible system and on Windows, these functions use the "C" locale for case insensitivity. otherwise, the comparison happens in the current locale. iykyk.
β RETURN VALUES β
both functions return an integer that is less than, equal to, or greater than zero, depending on whether s1 is found to be, respectively, less than, a match for, or greater than s2. that's the whole check-in, bestie. π
π NOTES π
OpenSSL uses case insensitive comparison of ASCII strings a lot β like, extensively. and here's the thing: even though OpenSSL itself is locale-agnostic, apps that use the OpenSSL libraries can unpredictably suffer when they mess with localization. the classic example? the Turkish locale, which is well-known for its specific I/i cases (yes, that's a real problem, no cap π).
these functions use the C locale for string comparison. so like, no surprises, no locale chaos. we stay unbothered. π§
π HISTORY π
these functions were added in OpenSSL 3.0.3. vintage-ish. π
π 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>.
lowkey reminder bestie: the license stuff is fr fr important, don't skip it just because it's at the bottom π«Ά
and that's the whole page!! mwah π β this was OPENSSL_STRCASECMP(3ossl), version 3.5.0, dated 2026-09-25. slay, go compare some strings. ππ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms