mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-26 01:03:37 +00:00
Backport from xs.
This commit is contained in:
parent
578d70ddc0
commit
74098ec443
2 changed files with 14 additions and 1 deletions
13
xs_encdec.h
13
xs_encdec.h
|
@ -6,6 +6,7 @@
|
|||
|
||||
xs_str *xs_hex_enc(const xs_val *data, int size);
|
||||
xs_val *xs_hex_dec(const xs_str *hex, int *size);
|
||||
int xs_is_hex(const char *str);
|
||||
xs_str *xs_base64_enc(const xs_val *data, int sz);
|
||||
xs_val *xs_base64_dec(const xs_str *data, int *size);
|
||||
xs_str *xs_utf8_enc(xs_str *str, unsigned int cpoint);
|
||||
|
@ -65,6 +66,18 @@ xs_val *xs_hex_dec(const xs_str *hex, int *size)
|
|||
}
|
||||
|
||||
|
||||
int xs_is_hex(const char *str)
|
||||
/* returns 1 if str is an hex string */
|
||||
{
|
||||
while (*str) {
|
||||
if (strchr("0123456789abcdefABCDEF", *str++) == NULL)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
xs_str *xs_base64_enc(const xs_val *data, int sz)
|
||||
/* encodes data to base64 */
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
/* b4afa5f823a998a263159ebfe9be67b81a8cc774 */
|
||||
/* 69d6e64d31491688ba4411e71c55e6c25482b17e */
|
||||
|
|
Loading…
Reference in a new issue