[fpc-pascal] Base36 encoding

Constantine Yannakopoulos alfasud.ti at gmail.com
Fri Mar 6 12:59:35 CET 2015

Hello all.

I need a couple of base36 (https://en.wikipedia.org/wiki/Base_36)
encoding/decoding functions with the following or similar signatures:

function Base36Encode(Buffer: TBytes): string; overload;
function Base36Encode(const Buffer; BufSize: Integer): string; overload;
function Base36Decode(const S: string): TBytes;

My aim is to encode/decode GUIDs and other binary data in a manner that can
be stored in a database CHAR (or VARCHAR) column with the least possible
size but in such a way that value comparisons do not need to be
case-sensitive. Thus far I've been using Base64 encoding for which I have
found efficient routines, but base64 requires case-sensitive
collation/comparisons and I would like to be able to avoid that.

Anybody knows where I could find such functions or care to share some? So
far the only ones I've found encode/decode only a single 32-bit integer or
a base10 string representation of a number and I would want to be able to
encode/decode a binary buffer of arbitrary size.

Thank you in advance

-- Constantine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150306/c8d99839/attachment.html>

More information about the fpc-pascal mailing list