Add EncodeHex() and DecodeHex() to Redbean

This commit is contained in:
Justine Tunney 2023-07-06 15:38:08 -07:00
parent 00acd81b2f
commit a186143f62
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
9 changed files with 97 additions and 13 deletions

View file

@ -721,14 +721,21 @@ FUNCTIONS
A granular. It can tell you if traffic originated from private
networks, ARIN, APNIC, DOD, etc.
DecodeLatin1(iso-8859-1:str) → utf-8:str
Turns ISO-8859-1 string into UTF-8.
EncodeHex(binary:str) → ascii:str
Turns binary into ASCII base-16 hexadecimal lowercase string.
DecodeHex(ascii:str) → binary:str
Turns ASCII base-16 hexadecimal byte string into binary string,
case-insensitively. Non-hex characters may not appear in string.
DecodeBase64(ascii:str) → binary:str
Turns ASCII into binary, in a permissive way that ignores
characters outside the base64 alphabet, such as whitespace. See
decodebase64.c.
DecodeLatin1(iso-8859-1:str) → utf-8:str
Turns ISO-8859-1 string into UTF-8.
EncodeBase64(binary:str) → ascii:str
Turns binary into ASCII. This can be used to create HTML data:
URIs that do things like embed a PNG file in a web page. See