![]() |
Fast QB64 base64 encoder & decoder - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Expanding Horizons (Libraries) (https://qb64phoenix.com/forum/forumdisplay.php?fid=21) +---- Forum: a740g (https://qb64phoenix.com/forum/forumdisplay.php?fid=55) +---- Thread: Fast QB64 base64 encoder & decoder (/showthread.php?tid=2184) Pages:
1
2
|
Fast QB64 base64 encoder & decoder - a740g - 11-18-2023 RETIRED! See this post. This is a Base64 encode, decode, and resource loader library based on MODP_B64, a C-based super-fast Base64 encoder and decoder library. The library has 4 functions: Code: (Select All)
It's much faster than my earlier QB64-only implementation which you can find here: Something Tricky (qb64phoenix.com). Here are some numbers from my Ryzen 5600X box. ![]() I threw in Win32 API-based Base64 encoder & decoder wrappers for the benchmark. However, the library is cross-platform. The numbers in the image are with C++ optimizations turned on. However, even with optimizations turned off MODP_B64 runs circles around Win32 and my earlier implementation. The Bin2Data tool lives here: https://qb64phoenix.com/forum/showthread.php?tid=2228 RE: Fast QB64 base64 encoder & decoder - Dav - 11-18-2023 Nice implementation! And As always your code is polished. - Dav RE: Fast QB64 base64 encoder & decoder - SpriggsySpriggs - 11-20-2023 Makes me wonder how fast mine is. https://qb64forum.alephc.xyz/index.php?topic=3819.msg131690#msg131690 EDIT: Hmm, very slow, also fails to decode the text from LOREM_IPSUM. Very odd. Never had any problems before and it worked with other Base64 strings that I had in the past. Was also a direct copy of a Rosetta task, so the algorithm might not be good. It fails on the "b4" line of the decode$ function. 2nd EDIT: Nice. If I dig up my Win32 version, it is super fast on my PC. Samuel's algo: Win32: Code: (Select All)
RE: Fast QB64 base64 encoder & decoder - a740g - 12-21-2024 The library is updated with the MODP_B64 based encoder/decoder which gives 3x+ faster encode/decode performance. Full update and download in the first post. RE: Fast QB64 base64 encoder & decoder - a740g - 02-23-2025 QB64-PE v4.1 has been released. See the announcement here. And with this release, I’ve decided to retire this library. The built-in functions, _BASE64ENCODE$ and _BASE64DECODE$ simply decimates the competition. So much so, that it puts the Win32 API CryptBinaryToStringA and CryptStringToBinaryA to shame. Below are some benchmarks. I've included the benchmark code in libbase64.zip\demos\base64\base64_demi.bas. Find the final zip in the first post. Cheers! Without C++ optimization: ![]() With C++ optimizations: ![]() RE: Fast QB64 base64 encoder & decoder - Pete - 02-24-2025 Hey Sam, @a740g A quarter of a century ago I wrote my own encryption for office data. It worked great but by today's standards would be considered obsolete. My question is how involved would this be using this new QB64 encryption function to get even something simple like a password encrypted? So say want to encrypt my password to this forum: password$ = "peteistremendousbutsteveisjustamazing" How would I encrypt that with this new feature so, unlike the example in the wiki, someone can't just decode it with _BASE64DECODE$? I would think there should be a key involved. Pete RE: Fast QB64 base64 encoder & decoder - SMcNeill - 02-24-2025 (02-24-2025, 09:00 PM)Pete Wrote: Hey Sam, @a740g https://qb64phoenix.com/qb64wiki/index.php/MD5$ https://qb64phoenix.com/qb64wiki/index.php/ADLER32 https://qb64phoenix.com/qb64wiki/index.php/CRC32 RE: Fast QB64 base64 encoder & decoder - Pete - 02-24-2025 ![]() https://qb64phoenix.com/qb64wiki/index.php/MD5$ Why did it have to be snakes Bit-flipping? And... Since I have 0 familiarity with any of those newer keywords, none of those tinker toys are going to fit together anytime soon. Pete RE: Fast QB64 base64 encoder & decoder - a740g - 02-25-2025 (02-24-2025, 09:00 PM)Pete Wrote: Hey Sam, @a740g Well, you should not use _BASE64ENCODE$ or even _DEFLATE$ for encrypting sensitive data because these are not encryption methods. Anyone can trivially reverse them using _BASE64DECODE$ and _INFLATE$. _MD5$, _ADLER32, and _CRC32 are not encryption but hashing/checksum functions and the results are not reversible. As you rightly pointed out, you would need something that takes a key and then encrypts the data using the key. To reverse the process and get back the original data, you would have to use the same key. I think something like AES should do the job quite well. I'll try to put together something over the weekend. RE: Fast QB64 base64 encoder & decoder - SpriggsySpriggs - 02-25-2025 Wait, we have hashing functions in QB64 now? |