Interesting idea
Some remotes are case insensitive - does it take into account capital letters?
Some remotes do count characters, but I think most just count the length in UTF-8, eg s3
The name for a key is a sequence of Unicode characters whose UTF-8 encoding is at most 1024 bytes long.
One idea might be to switch to base64. Even on a case insensitive remote the chance of a collision is quite low since the minimum length is 16 bytes before encoding...
16 bytes encodes to 22 bytes base64. So there are 2^22 possible collisions (codewords which are the same string when made lowercase) out of a possible 2^(8*16) codewords, ie a chance of any two codewords colliding is 2^-106 which is very small! So even if you have 2^32 files in a directory then this will leave chance of a single collision at roughly 2^-106 * 2^64 = 2^-42 which is still very small...