Hi,

I would like to start the discussion around implementing Base64 in pure Swift and making the implementation part of the Standard Library.

Currently the only "official" way is using Foundation and Foundation's Data type. To reduce the number of conversions between data types the swift on the server community includes an own implementation of Base64 in performance critical libraries. For example:

Since no-one should import SwiftNIO, Vapor or Noze just to get some Base64 functionality I just implemented another Base64 encoder and decoder for use in AWS client libraries, that I'm a part of. The code is public on GitHub and has been peer reviewed by @johannesweiss from the SwiftNIO team. The encoder is also now vendored in SwiftNIO. It is pure swift and uses no unsafe apis. Further it is generic, which makes the API more swifty.

@inlinable public static func encode<Buffer: Collection>(bytes: Buffer, options: EncodingOptions = []) -> String where Buffer.Element == UInt8

Especially considering the performance benefit on Linux and the generic approach I wonder if the community is interested in getting this functionality into the Standard Library as suggested once by @lukasa.

Update: Maybe this could be a candidate for the Standard Library Preview Package