I wish #PHP had two things and none of them involve generics... I wish it had type aliases and a native base32 encoding/decoding mechanism (in a class or a pair of functions I do not care)
accepting strings with 0, 1, 8, l, L, might require allowing for user-defined mappings.
Ideally the API looks the same as for base64, but I think it would be too simple to allow for all requirements. I wouldn't want to see a class for this though.
@derickr@Girgias did you have a chance to check how Python did it ? They use to have functions with signature similar to our current base64 approach but they did revamp the API https://docs.python.org/3/library/base64.html
Again I am not sure as you said that all should be covered but I believe being able to encode/decode hex and ascii should be possible natively
@derickr@Girgias If we stick with functions a la base64 we then need to add extra variables - the alphabet and maybe the padding character. so that user land can switch the alphabet and/or the padding character as they want PHP would only provide the Hex and Us-Ascii alphabet (those from the RFC)
So for encoding you would have at most 3 parameters and 4 on decode.
@derickr the best I could do is maybe creating the RFC and probably help with building the test suite but my knowledge of C is really not that great. Might be a goal for 2024 (talking about base32) type alias requires I believe a deeper knowledge of PHP internals that I really do not have
Add comment