fmt_asn1derlength(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– fmt_asn1derlength(3) πŸ’–

okay bestie, gather round, it's a Library Functions Manual moment and we're about to get into it ✨


🌸 NAME 🌸

fmt_asn1derlength β€” encode unsigned integer like ASN.1 DER length πŸŽ€


✨ SYNTAX ✨

#include <libowfat/fmt.h>

size_t fmt_asn1derlength(char *dest,unsigned long long source);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. fmt_asn1derlength encodes an unsigned integer using the ASN.1 DER rules for encoding tag lengths. no cap, that's the whole job. πŸ’…

the way this works, it can take anywhere from 1 byte (for the range 0-0x7f) all the way up to sizeof(source)+1 bytes. so it's giving flexible. it's giving adaptive. it's giving main character energy. πŸ‘‘

if dest equals FMT_LEN (i.e. it's NULL), then fmt_asn1derlength doesn't write anything β€” it just returns the number of bytes it would have written. lowkey the most useful trick ever. like, "hey how much room do i need?" and it just tells you. obsessed. πŸ™ˆ

and for convenience (bestie behaviour fr fr), fmt.h defines the integer FMT_ASN1LENGTH to be big enough to contain every possible fmt_asn1derlength output. so you never have to guess at your buffer size. slay. 🫢


🌈 SEE ALSO 🌈


okay that's the whole page, you ate that πŸ“ stay iconic, read your man pages, hydrate, and remember: this one came from the Library Functions Manual β€” fmt_asn1derlength(3) β€” and there's no date line on it so we're just vibing with the source, periodt πŸ’…πŸ’–