-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathb64.h
More file actions
118 lines (110 loc) · 5.28 KB
/
b64.h
File metadata and controls
118 lines (110 loc) · 5.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* Copyright (c) 2006-2007 Secure Endpoints Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Copyright (c) 1999
* The Trustees of Columbia University in the City of New York.
* All rights reserved.
*
* Permission is granted to you to use, copy, create derivative works,
* and redistribute this software and such derivative works for any
* purpose, so long as the name of Columbia University is not used in any
* advertising, publicity, or for any other purpose pertaining to the use
* or distribution of this software, other than for including the
* copyright notice set forth herein, without specific, written prior
* authorization. Columbia University reserves the rights to use, copy,
* and distribute any such derivative works for any purposes. The above
* copyright notice must be included in any copy of any portion of this
* software and the disclaimer below must also be included.
*
* THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION FROM THE
* TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK AS TO ITS
* FITNESS FOR ANY PURPOSE, AND WITHOUT WARRANTY BY THE TRUSTEES OF
* COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* THE TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK SHALL
* NOT BE LIABLE FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT,
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM
* ARISING OUT OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN IF
* IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGES. YOU SHALL INDEMNIFY AND HOLD HARMLESS THE TRUSTEES OF
* COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK, ITS EMPLOYEES AND
* AGENTS FROM AND AGAINST ANY AND ALL CLAIMS, DEMANDS, LOSS, DAMAGE OR
* EXPENSE (INCLUDING ATTORNEYS' FEES) ARISING OUT OF YOUR USE OF THIS
* SOFTWARE.
*
* The Trustees of Columbia University in the City of New York reserves
* the right to revoke this permission if any of the terms of use set
* forth above are breached.
*/
/*
* Copyright © 2000
* The Regents of the University of Michigan
* ALL RIGHTS RESERVED
*
* permission is granted to use, copy, create derivative works
* and redistribute this software and such derivative works
* for any purpose, so long as the name of the university of
* michigan is not used in any advertising or publicity
* pertaining to the use or distribution of this software
* without specific, written prior authorization. if the
* above copyright notice or any other identification of the
* university of michigan is included in any copy of any
* portion of this software, then the disclaimer below must
* also be included.
*
* this software is provided as is, without representation
* from the university of michigan as to its fitness for any
* purpose, and without warranty by the university of
* michigan of any kind, either express or implied, including
* without limitation the implied warranties of
* merchantability and fitness for a particular purpose. the
* regents of the university of michigan shall not be liable
* for any damages, including special, indirect, incidental, or
* consequential damages, with respect to any claim arising
* out of or in connection with the use of the software, even
* if it has been or is hereafter advised of the possibility of
* such damages.
*/
#ifndef _B64_H_
#define _B64_H_
int b64_decode(char *string, int len, char *out);
void b64_do_decode(char *bitstring, char *out, int *b64_cnt);
void b64_dodecode_padding(char *bitstring, int pad, char *out, int *b64_cnt);
void _b64_init(void);
#ifdef _REENTRANT
# include <pthread.h>
# define b64_init(); { pthread_once_t ctl = PTHREAD_ONCE_INIT; pthread_once(&ctl,_b64_init); }
#else /* !_REENTRANT */
# define b64_init(); _b64_init();
#endif /* !_REENTRANT */
int b64_encode(char *string, int len, char *out);
void b64_do_encode(char *bitstring, char *out, int *b64_cnt);
void b64_doencode_padding(char *bitstring, int pad, char *out, int *b64_cnt);
/*
static char b64_encoding[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
char b64_decoding[256];*/
extern int b64_init_done;
extern int b64_cnt;
#endif /* _B64_H_ */