综合技术

Websafe encoding of hashed string in nodejs

微信扫一扫,分享到朋友圈

Websafe encoding of hashed string in nodejs
0

I am creating a re-director of sorts in nodejs. I have a few values like
userid // superid

these I would like to hash to prevent users from retrieving the url and faking someone else’s url and also base64 encode to minimize the length of the url created.

http://myurl.com/~hashedtoken
where un-hashed hashtoken could be something like this
55q322q23
55 = userid

I thought about using crypto library like so:

crypto.createHash('md5').update("55q322q23").digest("base64");

which returns: u/mxNJQaSs2HYJ5wirEZOQ==
The problem here is that I have the / which is not considered websafe so I would like to strip the un-safe letters from the base64 list of letters, somehow. Any ideas about this or perhaps a better solution to the problem at hand?

阅读原文...


微信扫一扫,分享到朋友圈

Websafe encoding of hashed string in nodejs
0

Node.js Recipes

阿里为何新增GMV口径?

上一篇

Open the Android Camera app

下一篇

评论已经被关闭。

插入图片

热门分类

往期推荐

Websafe encoding of hashed string in nodejs

长按储存图像,分享给朋友