MCPcopy Create free account
hub / github.com/3proxy/3proxy / de64

Function de64

src/base64.c:40–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40int de64 (const char *in, char *out, int maxlen)
41{
42 int len = 0;
43 register unsigned char digit1, digit2, digit3, digit4;
44
45 if (in[0] == '+' && in[1] == ' ')
46 in += 2;
47 if (*in == '\r')
48 return(0);
49
50 do {
51 digit1 = in[0];
52 if (DECODE64(digit1) == BAD)
53 return(-1);
54 digit2 = in[1];
55 if (DECODE64(digit2) == BAD)
56 return(-1);
57 digit3 = in[2];
58 if (digit3 != '=' && DECODE64(digit3) == BAD)
59 return(-1);
60 digit4 = in[3];
61 if (digit4 != '=' && DECODE64(digit4) == BAD)
62 return(-1);
63 in += 4;
64 *out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4);
65 ++len;
66 if (digit3 != '=')
67 {
68 *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2);
69 ++len;
70 if (digit4 != '=')
71 {
72 *out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4);
73 ++len;
74 }
75 }
76 } while
77 (*in && *in != '\r' && digit4 != '=' && (maxlen-=4) >= 4);
78
79 return (len);
80}
81
82unsigned char hex[] = "0123456789ABCDEF";
83

Callers 3

proxychildFunction · 0.85
adminchildFunction · 0.85
smtppchildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected