#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <rz_types.h>
Go to the source code of this file.
|
static int | getc_nospace (FILE *f) |
|
static void | putc_wrap (char c, int wrap, int *len) |
|
static void | encode_tuple (unsigned long tuple, int count, int wrap, int *plen, int y_abbr) |
|
RZ_API void | rz_base85_decode_tuple (unsigned long tuple, int count) |
|
RZ_API void | rz_base85_encode (FILE *fp, int delims, int wrap, int y_abbr) |
|
RZ_API bool | rz_base85_decode (FILE *fp, int delims, int ignore_garbage) |
|
◆ encode_tuple()
Definition at line 54 of file base85.c.
57 if (tuple == 0 &&
count == 4) {
59 }
else if (tuple == 0x20202020 &&
count == 4 && y_abbr) {
62 for (
i = 0;
i < 5;
i++) {
63 out[
i] = tuple % 85 +
'!';
67 for (
i = 4;
i >= lim;
i--) {
static void putc_wrap(char c, int wrap, int *len)
const lzma_allocator const uint8_t size_t uint8_t * out
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
References count, i, out, and putc_wrap().
Referenced by rz_base85_encode().
◆ getc_nospace()
static int getc_nospace |
( |
FILE * |
f | ) |
|
|
static |
◆ putc_wrap()
static void putc_wrap |
( |
char |
c, |
|
|
int |
wrap, |
|
|
int * |
len |
|
) |
| |
|
static |
◆ rz_base85_decode()
Definition at line 110 of file base85.c.
112 unsigned long tuple = 0, pows[] = { 85 * 85 * 85 * 85, 85 * 85 * 85, 85 * 85, 85, 1 };
121 }
else if (
c == EOF) {
122 eprintf(
"ascii85: missing <~");
128 if (
c ==
'z' &&
count == 0) {
132 if (
c ==
'y' &&
count == 0) {
136 if (
c ==
'~' && delims) {
139 eprintf(
"ascii85: ~ without >\n");
146 if (delims && !
end) {
147 eprintf(
"ascii85: missing ~>");
151 tuple += pows[
count - 1];
156 if (c < '!' || c >
'u') {
157 if (ignore_garbage) {
160 eprintf(
"ascii85: invalid character '%c'\n",
c);
163 tuple += (
c -
'!') * pows[
count++];
static int getc_nospace(FILE *f)
RZ_API void rz_base85_decode_tuple(unsigned long tuple, int count)
References c, count, test_evm::end, eprintf, getc_nospace(), and rz_base85_decode_tuple().
◆ rz_base85_decode_tuple()
◆ rz_base85_encode()
RZ_API void rz_base85_encode |
( |
FILE * |
fp, |
|
|
int |
delims, |
|
|
int |
wrap, |
|
|
int |
y_abbr |
|
) |
| |
Definition at line 80 of file base85.c.
82 unsigned long tuple = 0;
90 tuple |=
c << ((3 -
count++) * 8);
94 }
else if (
count == 0) {
static void encode_tuple(unsigned long tuple, int count, int wrap, int *plen, int y_abbr)
References c, count, encode_tuple(), len, and putc_wrap().