31 lines
1017 B
C
31 lines
1017 B
C
// intellectual property is bullshit bgdc
|
|
|
|
#ifndef ASCII85_H
|
|
#define ASCII85_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <inttypes.h>
|
|
|
|
// Encode a block to ascii85. The destination buffer must contain at least
|
|
// (5/4) * rounded_up(len, 4) bytes (that is, enough bytes to encode src
|
|
// including padding bytes).
|
|
//
|
|
// "z" as an abbreviation for a block of four null bytes is not implemented
|
|
// to simplify buffer size requirements.
|
|
//
|
|
// Returns the total number of bytes used.
|
|
size_t ascii85_encode(uint8_t * dest, uint8_t const * src, size_t len);
|
|
|
|
// Decode a block from ascii85. The destination buffer must contain at least
|
|
// (4/5) * rounded_up(len, 5) bytes (that is, enough bytes to encode src
|
|
// including possible padding bytes).
|
|
//
|
|
// "z" as an abbreviation for a block of four null bytes is not implemented
|
|
// to simplify buffer size requirements.
|
|
//
|
|
// Returns the total number of bytes used.
|
|
size_t ascii85_decode(uint8_t * dest, uint8_t const * src, size_t len);
|
|
|
|
#endif // !defined(ASCII85_H)
|