Websafe encoding of hashed string in nodejs

前端 未结 2 1895
失恋的感觉
失恋的感觉 2021-01-25 05:34

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 fakin

2条回答
  •  甜味超标
    2021-01-25 06:00

    You could use a so called URL safe variant of Base64. The most common variant, described in RFC 4648, uses - and _ instead of + and / respectively, and omits padding characters (=).

    Most implementations of Base64 support this URL safe variant too, though if yours doesn't, it's easy enough to do manually.

提交回复
热议问题