小程序接口加密时去除昵称数据含有的reshuffle表情(例如emoji)

22 篇文章 1 订阅
15 篇文章 0 订阅

最近写的小程序,因为每次接口都要经过MD5加密,需要将获取的用户昵称一起加密发送到后台,开始自己做的时候顺其自让,毫无知觉拿过来直接扔进去加密,直到用后台人员的微信测试,中文验签失败,几周前已经调整过中文验签的签名算法,后来发现……
他的微信昵称里有3个屁……
具体是什么屁……
你打开你的输入法的emoji你会发现,里面有各种表情,其中就有一个屁……
于是想到的方法,将特殊符号先去除,替换成指定符号,再扔进去加密,上代码:

{
  nickName: name.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g, "**")
  //最后的两个星号是我替换的字符,一个特殊表情替换两个星号
}

至于为什么不是去除特殊表情,一开始第一反应是去除就好了,后来想到万一还有人只用特殊表情做昵称……那存进去的就是空字符串,到时候拿出来显示为空的,视觉不好看。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The OpenStack Foundation supported the creation of this book with plane tickets to Austin, lodging (including one adventurous evening without power after a windstorm), and delicious food. For about USD $10,000, we could collaborate intensively for a week in the same room at the Rackspace Austin office. The authors are all members of the OpenStack Foundation, which you can join. Go to the Foundation web site. We want to acknowledge our excellent host Rackers at Rackspace in Austin: Emma Richards of Rackspace Guest Relations took excellent care of our lunch orders and even set aside a pile of sticky notes that had fallen off the walls. Betsy Hagemeier, a Fanatical Executive Assistant, took care of a room reshuffle and helped us settle in for the week. The Real Estate team at Rackspace in Austin, also known as “The Victors,” were super responsive. Adam Powell in Racker IT supplied us with bandwidth each day and second monitors for those of us needing more screens. On Wednesday night we had a fun happy hour with the Austin OpenStack Meetup group and Racker Katie Schmidt took great care of our group. We also had some excellent input from outside of the room: Tim Bell from CERN gave us feedback on the outline before we started and reviewed it mid-week. Sébastien Han has written excellent blogs and generously gave his permission for re-use. Oisin Feeley read it, made some edits, and provided emailed feedback right when we asked. Inside the book sprint room with us each day was our book sprint facilitator Adam Hyde. Without his tireless support and encouragement, we would have thought a book of this scope was impossible in five days. Adam has proven the book sprint method effectively again and again. He creates both tools and faith in collaborative authoring at www.booksprints.net. We couldn’t have pulled it off without so much supportive help and encouragement.
07-23
OpenStack基金会为这本书的创作提供了机票前往奥斯汀、住宿(包括一次在一场风暴后没有电力的冒险夜晚)和美味的食物。花费约1万美元,我们可以在Rackspace奥斯汀办公室的同一个房间里密集合作一周。作者们都是OpenStack基金会的成员,您也可以加入。请访问基金会网站。 我们要感谢我们在奥斯汀的卓越主机Rackspace: Rackspace客户关系部的Emma Richards非常照顾我们的午餐订单,甚至为我们留下了一堆掉落的便签纸。 Fanatical行政助理Betsy Hagemeier负责房间调整,并帮助我们安顿下来。 Rackspace奥斯汀的房地产团队,也被称为“胜利者”,非常负责任。 Racker IT的Adam Powell每天为我们提供宽,并为那些需要更多屏幕的人提供了第二个显示器。 周三晚上,我们与奥斯汀OpenStack Meetup小组一起度过了愉快的欢乐光,Racker Katie Schmidt非常照顾我们的团队。 我们还得到了其他人的优秀意见: 来自CERN的Tim Bell在我们开始前对大纲提供了反馈,并在中途进行了审查。 Sébastien Han撰写了优秀的博客,并慷慨地允许我们重新使用。 Oisin Feeley阅读了书稿,做了一些编辑,并在我们提问立即提供了电子邮件反馈。 每天与我们一起进行书稿的房间里有我们的书稿会facilitator Adam Hyde。没有他不知疲倦的支持和鼓励,我们可能会认为在五天内完成这样一本书是不可能的。Adam一次又一次地证明了书稿会方法的有效性。他在www.booksprints.net上创建了协作创作的工具和信念。 没有这么多支持和鼓励,我们无法完成这本书。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值