fmt_asn1dertag(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_asn1dertag(3) β€” the Library Functions Manual girlies know

okay so bestie, welcome to fmt_asn1dertag, a lil function from the Library Functions Manual that lives in libowfat and is about to make ASN.1 DER tags your whole personality. πŸŽ€


✨ NAME ✨

fmt_asn1dertag β€” encode an unsigned integer like an ASN.1 DER tag πŸ¦‹


✨ SYNTAX ✨

#include <libowfat/fmt.h>

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

yes bestie, that's the whole vibe. two args, one return, zero drama. πŸ’–


✨ DESCRIPTION ✨

so what does it do? fmt_asn1dertag encodes an unsigned integer using the ASN.1 DER for encoding tag. 🫢

and the way it does that? it takes one byte for every 7 bits in the number. that's it, that's the encoding, no cap. ✨

now for the iconic part: if dest equals FMT_LEN (i.e. is NULL), then fmt_asn1dertag doesn't write anything β€” it just returns the number of bytes it would have written. it's giving "measure twice, cut once", main character energy. πŸ‘‘

and for convenience β€” because the libowfat girlies are thoughtful like that β€” fmt.h defines the integer FMT_ASN1TAG to be big enough to contain every possible fmt_asn1dertag output. so you never have to guess your buffer size, she already did it for you. πŸ’…


✨ SEE ALSO ✨


mwah, that's the page! this one came from the Library Functions Manual β€” source and all, dated the way the original was, and signed off as fmt_asn1dertag(3) like the icon she is. go forth and encode, bestie πŸ’œβœ¨