BN_ADD_WORD(3SSL)

๐Ÿ’– BN_ADD_WORD ๐Ÿ’–

okay so bestie, this is the BN_ADD_WORD(3SSL)</p> page from the OpenSSL manual, and it's literally the glow-up of BIGNUM math. instead of doing whole big-number arithmetic like a peasant, you just do math with plain old integers. so efficient. so slay. โœจ


๐ŸŒธ NAME ๐ŸŒธ

BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word โ€” arithmetic functions on BIGNUMs with integers ๐Ÿงฎ๐Ÿ’…


โœจ SYNOPSIS โœจ

#include <openssl/bn.h>

int BN_add_word(BIGNUM *a, BN_ULONG w);

int BN_sub_word(BIGNUM *a, BN_ULONG w);

int BN_mul_word(BIGNUM *a, BN_ULONG w);

BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);

BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so these functions do arithmetic on BIGNUMs with unsigned integers. and the way that they're so much more efficient than the normal BIGNUM arithmetic operations?? iconic. no cap. ๐Ÿ’…

  • BN_add_word() โ€” adds w to a ("a+=w") โž•
  • BN_sub_word() โ€” subtracts w from a ("a-=w") โž–
  • BN_mul_word() โ€” multiplies a and w ("a*=w") โœ–๏ธ
  • BN_div_word() โ€” divides a by w ("a/=w") and returns the remainder โž—
  • BN_mod_word() โ€” returns the remainder of a divided by w ("a%w") ๐ŸŒ€
๐Ÿ’€ GIRL. LISTEN. For BN_div_word() and BN_mod_word(), w must not be 0. zero. not a vibe. do not.

๐Ÿ‘‘ RETURN VALUES ๐Ÿ‘‘

  • BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0 on error. and if you're like "okay but which error ๐Ÿฅบ", you can go get the error codes with ERR_get_error(3). periodt.
  • BN_mod_word() and BN_div_word() return a%w on success and (BN_ULONG)-1 if an error occurred. yeah bestie, that's the screaming number ๐Ÿ˜ญ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ


Copyright 2000-2017 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>. ๐Ÿ“œ


and that's the whole page bestie, no crumbs left ๐Ÿ’– this was OpenSSL version 4.0.3, dated 2026-09-29, filed under BN_ADD_WORD(3SSL). go forth and do tiny integer math on your giant numbers, you absolute main character. mwah ๐Ÿงšโœจ

๐Ÿ“ฆ where this page comes from