创建imgur图像名称
看看 imgur 网站上的标准 URL:
http://i.imgur.com/zx24u.jpg
我想知道他们是如何想出 zx24u
字符串的?
为什么我问:
我使用 MD5 创建图像的十六进制摘要,然后将其存储在数据库中。摘要如下所示:
8da0ed0e5862b120a886a29d7800b59b
我只是想知道应该如何获取 ASCII 和 url 友好的图像名称。 (我是java用户)
Take a look at the standard URL from imgur website:
http://i.imgur.com/zx24u.jpg
I was wondering how do they come up with zx24u
string?
Why I'm asking:
I use MD5 to create hex digest of image and than I store it in a database. The digest looks like this:
8da0ed0e5862b120a886a29d7800b59b
I'm just wondering what should I do to get ASCII
and url friendly image name. (I'm java user)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用随机数生成器,以散列作为种子并将其输出范围调整为您的 ASCII 范围。
You can use a random number generator, seeded with the hash and fit the range of its output to your ASCII range.
您可以去掉它的前几个字符,也可以生成一个随机字符串来识别图像。我认为imgur使用第二种方式。
You can strip the first few character for it, or you can generate a random string for identify image. I think imgur uses the second way.