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 s1 is found to be less than s2
  • equal to zero if s1 matches s2
  • greater than zero if s1 is found to be greater than s2

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 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