fmt_asn1dertag(3)
π 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 β¨
scan_asn1dertag(3)β the reverse queen πΈ
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 πβ¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms