We're using a file system/url safe variation of base64 encoding such that:
"=" replaced with ""
"+" replaced with "-"
"/" replaced with "_"
We are now using Azure blob storage that does not allow use of "_" within container names.
We are base64 encoding a Guid. If I was to replace underscore with say a "0" am I at risk of collisions?
Not sure why the downvote. But to clarify.
Why not just use a Guid?
I want shorter and more friendly looking paths. Contrary to one of the comments below, the base 64 encoding is NOT longer:
Guid: 5b263cdd-2bc2-485d-83d4-81b96930dc5a
Base64 Encoded: 3TwmW8IrXUiD1IG5aTDcWg== (even shorter after removing ==)
Seems there is some confusion about what it is I'm trying to achieve (so sorry about that). Heres the short version.
This is where I'm at.
Just "encode" the GUID in base16. The only characters it uses are 0123456789ABCDEF which should be safe for most purposes.
var encoded = guid.ToString("N");
The base 64 character set is
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
So you can't use 0 since it is already in use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With