Refactor ronin/support/encoding/base64 to not use the Base64 library#563
Closed
Refactor ronin/support/encoding/base64 to not use the Base64 library#563
ronin/support/encoding/base64 to not use the Base64 library#563Conversation
* Also add `String#smtp_escape`, `String#smtp_encode`, `String#smtp_unescape`, and `String#smtp_decode` as aliases to `String#quoted_printable_*` methods.
…rypto_des3_decrypt`.
* This matches the other `Encoding` modules.
* Because `URI::QueryParams::Mixin` uses `module_eval` to re-alias the `query=` method, this causes `query=` to get aliased to itself.
* Decoding [Perl Unicode Named Characters][1] is currently not supported and will raise a `NotImplementedError`. [1]: https://www.perl.com/pub/2012/04/perlunicook-unicode-named-characters.html/
* This more closely matches the C99 definition. See https://en.wikipedia.org/wiki/Flexible_array_member
postmodern
requested changes
Feb 16, 2025
Member
postmodern
left a comment
There was a problem hiding this comment.
Minor naming change suggestions.
| when nil then ::Base64.encode64(data) | ||
| when :strict then strict_encode64(data) | ||
| when :url_safe then urlsafe_encode64(data) | ||
| when nil then encode64(data) |
Member
There was a problem hiding this comment.
Inline the encode64 logic directly into encode.
| when nil then ::Base64.decode64(data) | ||
| when :strict then strict_decode64(data) | ||
| when :url_safe then urlsafe_decode64(data) | ||
| when nil then decode64(data) |
Member
There was a problem hiding this comment.
Inline the decode64 logic directly into decode.
| # @return [String] | ||
| # The Base64 encoded data. | ||
| # | ||
| def self.encode64(data) |
| # @return [String] | ||
| # The decoded data. | ||
| # | ||
| def self.decode64(data) |
| # @return [String] | ||
| # The Base64 strict encoded data. | ||
| # | ||
| def self.strict_encode64(data) |
| # @return [String] | ||
| # The strict decoded data. | ||
| # | ||
| def self.strict_decode64(data) |
| # @return [String] | ||
| # The Base64 url-safe encoded data. | ||
| # | ||
| def self.urlsafe_encode64(data, padding: true) |
| # @return [String] | ||
| # The url-safe decoded data. | ||
| # | ||
| def self.urlsafe_decode64(data) |
Member
|
I will probably need to manually cherry-pick your commits out since you merged |
Member
Author
Damn.. I don't know when it happened.. I'll create new PR for that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#561