forked from lemire/fastbase64
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef SCALAR_B64 | ||
#define SCALAR_B64 | ||
|
||
/** | ||
* Assumes recent x64 hardware with AVX2 instructions. | ||
*/ | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
|
||
/** | ||
* We copy the code below from https://github.com/aklomp/base64 | ||
**/ | ||
|
||
|
||
/* Wrapper function to decode a plain string of given length. Output is written | ||
* to *out without trailing zero. Output length in bytes is written to *outlen. | ||
* The buffer in `out` has been allocated by the caller and is at least 3/4 the | ||
* size of the input. */ | ||
int scalar_base64_decode | ||
( const char *src | ||
, size_t srclen | ||
, char *out | ||
, size_t *outlen | ||
) ; | ||
|
||
|
||
/* Wrapper function to encode a plain string of given length. Output is written | ||
* to *out without trailing zero. Output length in bytes is written to *outlen. | ||
* The buffer in `out` has been allocated by the caller and is at least 4/3 the | ||
* size of the input. */ | ||
void scalar_base64_encode | ||
( const char *src | ||
, size_t srclen | ||
, char *out | ||
, size_t *outlen | ||
) ; | ||
|
||
|
||
#endif |