base64.h

来自「linux集群服务器软件代码包」· C头文件 代码 · 共 36 行

H
36
字号
/* $Id: base64.h,v 1.3 2004/02/17 22:11:58 lars Exp $ */#ifndef _CLPLUMBING_BASE64_H#	define _CLPLUMBING_BASE64_H/* * * Base64 conversion functions. * They convert from a binary array into a single string * in base 64.  This is almost (but not quite) like section 5.2 of RFC 1341 * The only difference is that we don't care about line lengths. * We do use their encoding algorithm. * */#define	B64inunit	3#define	B64outunit	4/* How long will the base64 string be for a particular binary object size? *//* This is like strlen() and doesn't include the '\0' byte at the end */#define	B64_stringlen(bytes)	\	((((bytes)+(B64inunit-1))/B64inunit)*B64outunit)/* How many bytes to you need to malloc to store a base64 string? *//* (includes space for the '\0' terminator byte) */#define	B64_stringspace(bytes)	(B64_stringlen(bytes)+1)/* How many bytes will a base64 string take up back in binary? *//* Note:  This may be as much as two 2 bytes more than strictly needed */#define	B64_maxbytelen(slen)	(((slen) / B64outunit)*B64inunit)/* Returns strlen() of base64 string returned in "output" */int binary_to_base64(const void * data, int nbytes, char * output, int outlen);/* Returns the size of the binary object we returned in "output" */int base64_to_binary(const char * input, int inlen, void * output, int outlen);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?