Hoew通过userId获取会员资格用户名 [英] Hoew to get membership username by userId

查看:188
本文介绍了Hoew通过userId获取会员资格用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想通过UserId获得会员用户名。我知道UserId,当传递UserId时如何获取Username.I使用了Hash algaritham SHA1方法。

任何人都知道回复我。

谢谢

Hi,
I want to get Membership UserName through UserId. I know the UserId, when passing UserId how to get Username.I used Hash algaritham SHA1 method.
can any one know reply me.
Thanks

推荐答案

如果您通过使用SHA1生成用户名的哈希版本来从用户名生成UserID,那么您唯一的选择是使用您已知的UserID查询数据库并获取用户名从那里。您无法撤消SHA1并返回原始输入用户名:它是散列算法,而不是加密算法。加密可以反转,哈希不能。





BTW:通过散列从用户名生成用户ID是最愚蠢的想法之一我听了很长时间......可能是你的公司政策,但这并不意味着它是对的!
If you generated your UserID from the username by using SHA1 to generate a hashed version of the username, then your only option is to query the database using the UserID that you known and get the Username from there. You cannot reverse an SHA1 and get the original input username back: it is a hashing algorithm, not an encryption algorithm. Encryption can be reversed, hashing cannot.


BTW: Generating a user ID from a username by hashing it is one of the silliest ideas I have heard in a long time...it may be you company policy, but that doesn't mean it's right!


这篇关于Hoew通过userId获取会员资格用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆