BN_CMP(3)
π BN_CMP(3) β BIGNUM comparison and test functions π
hey bestie!! π«Ά this is the BN_CMP(3) page from the Library Functions Manual, and it's literally all about BIGNUM comparison and test functions. no cap, we're gonna make it make sense. β¨
π NAME π
BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_abs_is_word, BN_is_odd β BIGNUM comparison and test functions. that's the whole squad, and yes they ate. π
β¨ SYNOPSIS β¨
okay so first the library tea:
library βlibcryptoβ #include <openssl/bn.h>
then the function signatures, exactly as they are, bestie β these are the int-returning icons:
int
BN_cmp(const BIGNUM *a, const BIGNUM *b);
int
BN_ucmp(const BIGNUM *a, const BIGNUM *b);
int
BN_is_zero(const BIGNUM *a);
int
BN_is_one(const BIGNUM *a);
int
BN_is_word(const BIGNUM *a, const BN_ULONG w);
int
BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
int
BN_is_odd(const BIGNUM *a);
π DESCRIPTION π
BN_cmp() compares the numbers a and b. BN_ucmp() compares their absolute values. that's the difference, bestie β BN_ucmp() is the absolute-value twin. π¦
BN_is_zero(), BN_is_one(), and BN_is_word() test if a equals 0, 1, or w, respectively. BN_abs_is_word() tests if the absolute value of a equals w. BN_is_odd() tests if a is odd. literally just little vibe checks for your BIGNUM. π₯
BN_ULONG is a macro that expands to unsigned long (= uint64_t) on _LP64 platforms and unsigned int (= uint32_t) elsewhere. periodt. π
π RETURN VALUES π
BN_cmp()returns-1ifa<b,0ifa==b, and1ifa>b. iconic. βBN_ucmp()is the same using the absolute values ofaandb.BN_is_zero(),BN_is_one(),BN_is_word(),BN_abs_is_word(), andBN_is_odd()return1if the condition is true,0otherwise. so it's giving yes/no, true/false, 1/0 realness. π
π¦ SEE ALSO π¦
BN_new(3) β go read that one too, bestie, it's the BIGNUM origin story. πΈ
π HISTORY π
BN_cmp(), BN_ucmp(), BN_is_zero(), BN_is_one(), and BN_is_word() first appeared in SSLeay 0.5.1. BN_is_odd() first appeared in SSLeay 0.8.0. These functions have been available since OpenBSD 2.4. π
BN_abs_is_word() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2. the way this one has its own little timeline?? obsessed. π°οΈ
mwah π and that's the footer tea: source/version is Debian, date is June 8, 2025. thank you for coming to my TED talk, now go compare some BIGNUMs. π
β¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2000 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms