简体   繁体   English

如何将哈希转换为Live API for Contacts的响应

[英]How to convert hash into text from the response of Live API for Contacts

I have integrated Live JS api to fetch Live contacts of a user, it returns emails in hash format (email_hash). 我已经集成了Live JS api来获取用户的Live联系人,它以散列格式(email_hash)返回电子邮件。 How can i convert into readable text, using javascript or c#.net Many thanks! 如何使用javascript或c#.net转换为可读文本非常感谢!

I had the same problem and I find the solution, all you need to do is add the following scope to your list of scopes you're requesting: "wl.contacts_emails" 我有同样的问题,我找到了解决方案,您只需将以下范围添加到您要求的范围列表中:“wl.contacts_emails”

WL.login({scopes: ["wl.contacts_emails"]});

After did that, I had to remove my application from my profile to reset all scope and add a second time my application. 完成后,我不得不从我的配置文件中删除我的应用程序以重置所有范围并再次添加我的应用程序。 (But if you don't want to ask all people who alerady use your apps, I can just reset secret token to force user to add again your app). (但如果你不想问所有alerady使用你的应用程序的人,我可以重置秘密令牌以强制用户再次添加你的应用程序)。

Best, Thierry 最好,蒂埃里

I'm in agreement with Jon. 我和乔恩同意。 A hash is one-way, that is, two email addresses may share the same hash, although it's usually unlikely. 散列是单向的,也就是说,两个电子邮件地址可以共享相同的散列,尽管通常不太可能。 It's not designed to be "decoded," that's encryption ( SO answer on how they're used ). 它的设计不是“解码”,而是加密如何使用它们的答案 )。 The point is for you to be able to check it against an email address or addresses you already have . 关键是您可以根据您已有的电子邮件地址或地址进行检查。

Microsoft has some sample code on their website that may or may not be what you're looking for, but it seems like you're querying the contact list of a user who has provided his email address to your website. 微软在他们的网站上有一些示例代码可能是您正在寻找的,也可能不是您想要的,但似乎您正在查询已向您的网站提供其电子邮件地址的用户的联系人列表。 Microsoft then allows you to see a list of contacts with their emails hashed. 然后,Microsoft允许您查看其电子邮件散列的联系人列表。 This is done for privacy reasons so you can't just collect all the emails in someone's contact list. 这样做是出于隐私原因,因此您不能只收集某人联系人列表中的所有电子邮件。

For an example of how it might be implemented in practice, think of Facebook's Friend Finder feature. 有关如何在实践中实施的示例,请考虑Facebook的Friend Finder功能。 You provide an email address, receive a bunch of hashed email addresses, then compare to the hashed email addresses of your own registered users looking for matches. 您提供一个电子邮件地址,接收一堆散列的电子邮件地址,然后与您自己的注册用户的哈希电子邮件地址进行比较,以查找匹配项。 (FB's actual implementation is probably a little different than I'm suggesting.) (FB的实际实施可能与我建议的有点不同。)

I'm not familiar with the Windows Live SDK but a hash is generally a one way representation. 我不熟悉Windows Live SDK,但哈希通常是单向表示。 For example, taking the first two letters of an email address would be a hash - a very bad one, but a hash nonetheless. 例如,取一个电子邮件地址的前两个字母将是一个哈希 - 一个非常糟糕的,但仍然是哈希。 The point of a hash (in crypto terms) is to be able to determine quickly whether two source values are likely to be equal without storing/revealing the original data. 散列点(以加密术语表示)是能够快速确定两个源值是否可能相等而不存储/显示原始数据。

In other words: assuming I'm right about the kind of hash we're talking about, you won't be able to get back to the original email address. 换句话说:假设我说的是我们正在讨论的那种哈希,你将无法回到原始的电子邮件地址。

EDIT: Assuming it's the same sort of email hash described here , it uses SHA-256 which is a cryptographic one way hash. 编辑:假设它是这里描述的相同类型的电子邮件哈希 ,它使用SHA-256 ,这是一种加密单向哈希。 The point of hashing here is so that you'll be able to see whether any of the user's contacts is already a user of your site (or whatever), but without revealing the user's contacts in plain text, which would violate their privacy. 此处的哈希点是,您将能够看到用户的任何联系人是否已经是您网站的用户(或其他任何用户),但不会以纯文本显示用户的联系人,这会侵犯他们的隐私。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM