| 1 |
'\" t |
| 2 |
.\" Copyright 2002, Walter Harms <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 6 |
.\" |
| 7 |
.TH a64l 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
a64l, l64a \- convert between long and base-64 |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <stdlib.h> |
| 16 |
.P |
| 17 |
.BI "long a64l(const char *" str64 ); |
| 18 |
.BI "char *l64a(long " value ); |
| 19 |
.fi |
| 20 |
.P |
| 21 |
.RS -4 |
| 22 |
Feature Test Macro Requirements for glibc (see |
| 23 |
.BR feature_test_macros (7)): |
| 24 |
.RE |
| 25 |
.P |
| 26 |
.BR a64l (), |
| 27 |
.BR l64a (): |
| 28 |
.nf |
| 29 |
_XOPEN_SOURCE >= 500 |
| 30 |
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED |
| 31 |
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE |
| 32 |
|| /* glibc <= 2.19: */ _SVID_SOURCE |
| 33 |
.fi |
| 34 |
.SH DESCRIPTION |
| 35 |
These functions provide a conversion between 32-bit long integers |
| 36 |
and little-endian base-64 ASCII strings (of length zero to six). |
| 37 |
If the string used as argument for |
| 38 |
.BR a64l () |
| 39 |
has length greater than six, only the first six bytes are used. |
| 40 |
If the type |
| 41 |
.I long |
| 42 |
has more than 32 bits, then |
| 43 |
.BR l64a () |
| 44 |
uses only the low order 32 bits of |
| 45 |
.IR value , |
| 46 |
and |
| 47 |
.BR a64l () |
| 48 |
sign-extends its 32-bit result. |
| 49 |
.P |
| 50 |
The 64 digits in the base-64 system are: |
| 51 |
.P |
| 52 |
.RS |
| 53 |
.nf |
| 54 |
\&\[aq].\[aq] represents a 0 |
| 55 |
\&\[aq]/\[aq] represents a 1 |
| 56 |
0-9 represent 2-11 |
| 57 |
A-Z represent 12-37 |
| 58 |
a-z represent 38-63 |
| 59 |
.fi |
| 60 |
.RE |
| 61 |
.P |
| 62 |
So 123 = 59*64\[ha]0 + 1*64\[ha]1 = "v/". |
| 63 |
.SH ATTRIBUTES |
| 64 |
For an explanation of the terms used in this section, see |
| 65 |
.BR attributes (7). |
| 66 |
.TS |
| 67 |
allbox; |
| 68 |
lbx lb lb |
| 69 |
l l l. |
| 70 |
Interface Attribute Value |
| 71 |
T{ |
| 72 |
.na |
| 73 |
.nh |
| 74 |
.BR l64a () |
| 75 |
T} Thread safety MT-Unsafe race:l64a |
| 76 |
T{ |
| 77 |
.na |
| 78 |
.nh |
| 79 |
.BR a64l () |
| 80 |
T} Thread safety MT-Safe |
| 81 |
.TE |
| 82 |
.SH STANDARDS |
| 83 |
POSIX.1-2008. |
| 84 |
.SH HISTORY |
| 85 |
POSIX.1-2001. |
| 86 |
.SH NOTES |
| 87 |
The value returned by |
| 88 |
.BR l64a () |
| 89 |
may be a pointer to a static buffer, possibly overwritten |
| 90 |
by later calls. |
| 91 |
.P |
| 92 |
The behavior of |
| 93 |
.BR l64a () |
| 94 |
is undefined when |
| 95 |
.I value |
| 96 |
is negative. |
| 97 |
If |
| 98 |
.I value |
| 99 |
is zero, it returns an empty string. |
| 100 |
.P |
| 101 |
These functions are broken before glibc 2.2.5 |
| 102 |
(puts most significant digit first). |
| 103 |
.P |
| 104 |
This is not the encoding used by |
| 105 |
.BR uuencode (1). |
| 106 |
.SH SEE ALSO |
| 107 |
.BR uuencode (1), |
| 108 |
.\" .BR itoa (3), |
| 109 |
.BR strtoul (3) |