Commit 4cef4bd0 authored by Niels Möller's avatar Niels Möller

(base64_encode_group): New function, used by openpgp

armoring code.

Rev: src/nettle/base64.c:1.5
Rev: src/nettle/base64.h:1.7
parent 3dd1a881
......@@ -59,6 +59,15 @@ static const signed char decode_table[256] =
#define ENCODE(x) (encode_table[0x3F & (x)])
void
base64_encode_group(uint8_t *dst, uint32_t group)
{
*dst++ = ENCODE(group >> 18);
*dst++ = ENCODE(group >> 12);
*dst++ = ENCODE(group >> 6);
*dst++ = ENCODE(group);
}
unsigned
base64_encode(uint8_t *dst,
unsigned src_length,
......
......@@ -46,6 +46,10 @@ base64_encode(uint8_t *dst,
((BASE64_BINARY_BLOCK_SIZE - 1 + (src_length)) \
/ BASE64_BINARY_BLOCK_SIZE * BASE64_TEXT_BLOCK_SIZE)
/* Encode a single group */
void
base64_encode_group(uint8_t *dst, uint32_t group);
/* FIXME: Perhaps rename to base64_decode_ctx? */
struct base64_ctx /* Internal, do not modify */
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment