mirror of
https://github.com/ipxe/ipxe
synced 2025-12-24 06:22:59 +03:00
[base64] Add base64 encoding functions
This commit is contained in:
24
src/include/gpxe/base64.h
Normal file
24
src/include/gpxe/base64.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _GPXE_BASE64_H
|
||||
#define _GPXE_BASE64_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Base64 encoding
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Calculate length of base64-encoded string
|
||||
*
|
||||
* @v raw_len Raw string length (excluding NUL)
|
||||
* @ret encoded_len Encoded string length (excluding NUL)
|
||||
*/
|
||||
static inline size_t base64_encoded_len ( size_t raw_len ) {
|
||||
return ( ( ( raw_len + 3 - 1 ) / 3 ) * 4 );
|
||||
}
|
||||
|
||||
extern void base64_encode ( const char *raw, char *encoded );
|
||||
|
||||
#endif /* _GPXE_BASE64_H */
|
||||
Reference in New Issue
Block a user