GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PWS_BASE64_DECODE (3)

NAME

pws_base64_encode, pws_base64_decode - Encode and decode strings to and from Base64

CONTENTS

Library
Synopsis
Description
See Also

LIBRARY

-lpwstor

SYNOPSIS


.In pwstor.h unsigned char *
.Fo pws_base64_encode unsigned char *src unsigned char *dst size_t len
.Fc unsigned char *
.Fo pws_base64_decode unsigned char *src unsigned char *dst
.Fc

DESCRIPTION

The function pws_base64_encode will encode len bytes of data from the memory referenced by pointer src and store that data in the memory referenced by pointer dst. The pointer dst must be at least large enough to hold (( len * 2) +1) bytes of data just to be on the safe side. (While this isn’t technically correct, the actual expansion is a fraction, which multiplying by floating point integers may confuse some inexperienced programmers who may then fall victim to buffer overflows. Experienced developers should know how much memory is necessary and be able to calculate it more appropriately to save a few bytes, but *2 will always work safely.) The +1 is to allow for the storage of a null-terminating byte, since pws_base64_decode expects its Base64-encoded argument to be null-terminated. Adding the null-terminating byte is up to the application, however the safest thing to do is generally to use memset or calloc so that the memory buffer will be initialized to 0s regardless, and it can simply be propagated by the pws_base64_encode function. A pointer to the memory buffer referenced by dst is returned.

The function pws_base64_decode can be used to decode data stored in memory pointed to by src from Base64 back to its true value. The true value will be stored in the memory pointed to by dst. Since src is Base64 encoded, it is expected to be a null-terminated string. The dst argument is expected to be a pointer to a memory buffer large enough to store the results of decoding in. A pointer to the memory buffer referenced by dst is returned.

SEE ALSO

pwstor(3)
Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.