OPENSSL_STRCASECMP(3ossl)
π OPENSSL_STRCASECMP π
okay bestie, welcome to the 3ossl manual page for OPENSSL_strcasecmp and OPENSSL_strncasecmp β the two little functions that let you compare strings while β¨completely ignoring caseβ¨. no cap.
πΈ 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);
like. that's it. that's the whole vibe check. π¦
π DESCRIPTION π
So OPENSSL_strcasecmp does a byte-by-byte comparison of the strings s1 and s2, and it literally just ignores the case of the characters. 'A' vs 'a'? not the drama. we move on. π
OPENSSL_strncasecmp is the same energy, except it compares no more than n bytes of s1 and s2. so it's giving "short king" β it knows when to stop. π
On 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. iykyk. π
π RETURN VALUES π
Both functions hand you back an integer, and the tea is:
- 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
fr fr, that's the whole scale. πβ¨
π§ NOTES π§
OpenSSL extensively uses case insensitive comparison of ASCII strings. icon behavior honestly.
But here's the thing, bestie β even though OpenSSL itself is locale-agnostic, applications using OpenSSL libraries may unpredictably suffer when they use localization. the classic example: the Turkish locale is well-known for its very specific I/i cases. π
so yeah, these functions use the C locale for string comparison. that's the safe lane. stay in it. π«Ά
π¦ HISTORY π¦
These functions were added in OpenSSL 3.0.3. babygirls are relatively new but they've been carrying their weight. π
π 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.
okay that's the whole page, bestie!! πβ¨ππ¦πΈπ π«Ά
and for the lil sign-off: this was version 3.5.9, dated 2026-09-29, and yes it's still OPENSSL_STRCASECMP(3ossl) β periodt. ππβ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms