-
Notifications
You must be signed in to change notification settings - Fork 36
Add simple base64 de/encoding #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #372 +/- ##
==========================================
+ Coverage 92.89% 92.98% +0.09%
==========================================
Files 64 65 +1
Lines 15679 15797 +118
==========================================
+ Hits 14565 14689 +124
+ Misses 1114 1108 -6
Continue to review full report at Codecov.
|
|
Alright @9il, I believe I addressed all of your points (and more). One point of issue was how to handle a Base64 string like So, I've taken the safest route, in my opinion (while still being compliant to RFC4648), and decided to just throw if we meet one of two situations:
This does mean that Base64 strings like Let me know if you have any other concerns. |
source/mir/base64.d
Outdated
| /++ | ||
| Encode a ubyte array as Base64, placing the result onto an Appender. | ||
| +/ | ||
| void encodeBase64(char PlusChar = '+', char SlashChar = '/', Appender)(scope const(ubyte)[] input, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to make PlusChar and SlashChar generic params as well as CapitalCase. Make them runtime and camelCase.
This PR adds in a relatively simplistic Base64 (de|en)coder (#369)
It is incredibly simple by design, as well as being
@nogc @safe pure(except for the functions that do not take in Appenders). I've only tested it with some small bits of data, but, it should easily scale up to handle an infinite amount of data.I have not verified how this fares with systems that are big-endian -- would love more insight on that regard.
Let me know if this needs any more work. Thanks!