Sha256: 677ee46916ee80118414bb8e794773b8cb93482aa782e0f5b9a1d7c6296ea7b7
Contents?: true
Size: 1.83 KB
Versions: 3
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true # # Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com) # # ronin-support is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ronin-support is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with ronin-support. If not, see <https://www.gnu.org/licenses/>. # require 'ronin/support/encoding/base64' class String # # [Base64] encodes a string. # # [Base64]: https://en.wikipedia.org/wiki/Base64 # # @param [Symbol, nil] mode # The base64 mode to use. May be either: # # * `nil` # * `:strict` # * `:url_safe` # # @return [String] # The base64 encoded form of the string. # # @example # "hello".base64_encode # # => "aGVsbG8=\n" # # @api public # def base64_encode(mode: nil) Ronin::Support::Encoding::Base64.encode(self, mode: mode) end # # [Base64] decodes a string. # # [Base64]: https://en.wikipedia.org/wiki/Base64 # # @param [Symbol, nil] mode # The base64 mode to use. May be either: # # * `nil` # * `:strict` # * `:url_safe` # # @return [String] # The base64 decoded form of the string. # # @note # `mode` argument is only available on Ruby >= 1.9. # # @example # "aGVsbG8=\n".base64_decode # # => "hello" # # @api public # def base64_decode(mode: nil) Ronin::Support::Encoding::Base64.decode(self, mode: mode) end end
Version data entries
3 entries across 3 versions & 1 rubygems