Est-ce que quelqu'un a une classe ouvrière ou une fonction pour créer le courriel haché qui est envoyé à facebook pour enregistrer des adresses e-mail avec connect.registerUsers?Facebook Connect Fonction de hachage de courrier électronique pour vb.net
Répondre
compris cela sur mon propre
Imports System.Net
Importations tb2CoreLib
importations Microsoft.Xml.Schema. LINQ
importations System.Security.Cryptography
importations facebook.Uti lité
Importations Microsoft.Xml
Imports System.Xml
Imports System.Web
Classe publique FacebookConnect
Fonction publique EmailHash (e-mail ByVal As String) As String
email = email.ToLower().Trim()
Dim rawBytes As Byte() = System.Text.UTF8Encoding.UTF8.GetBytes(email)
Dim crc As New Crc32()
Dim crcResult As Byte() = crc.ComputeHash(rawBytes)
Dim hexstring As String = Me.ToHexString(crcResult)
Dim crcLResult As Long = Me.HexToDec(hexstring)
Dim md5 As MD5 = New MD5CryptoServiceProvider()
Dim md5Result As Byte() = md5.ComputeHash(rawBytes)
Dim md5Data As String = Me.ToHexString(md5Result).ToLower()
Return (crcLResult.ToString() & "_") + md5Data
End Function
fin de classe
Imports System
Importations System.Security.Cryptography
Classe publique Crc32
Inherits HashAlgorithm
Public Const DefaultPolynomial As UInt32 = &HEDB88320UI
Public Const DefaultSeed As UInt32 = &HFFFFFFFFUI
Private Shadows hash As UInt32
Private seed As UInt32
Private table As UInt32()
Private Shared defaultTable As UInt32()
Public Sub New()
table = InitializeTable(DefaultPolynomial)
seed = DefaultSeed
Initialize()
End Sub
Public Sub New(ByVal polynomial As UInt32, ByVal seed As UInt32)
table = InitializeTable(polynomial)
Me.seed = seed
Initialize()
End Sub
Public Overloads Overrides Sub Initialize()
hash = seed
End Sub
Protected Overloads Overrides Sub HashCore(ByVal buffer As Byte(), ByVal start As Integer, ByVal length As Integer)
hash = CalculateHash(table, hash, buffer, start, length)
End Sub
Protected Overloads Overrides Function HashFinal() As Byte()
Dim hashBuffer As Byte() = UInt32ToBigEndianBytes(Not hash)
Me.HashValue = hashBuffer
Return hashBuffer
End Function
Public Overloads Overrides ReadOnly Property HashSize() As Integer
Get
Return 32
End Get
End Property
Public Shared Function Compute(ByVal buffer As Byte()) As UInt32
Return Not CalculateHash(InitializeTable(DefaultPolynomial), DefaultSeed, buffer, 0, buffer.Length)
End Function
Public Shared Function Compute(ByVal seed As UInt32, ByVal buffer As Byte()) As UInt32
Return Not CalculateHash(InitializeTable(DefaultPolynomial), seed, buffer, 0, buffer.Length)
End Function
Public Shared Function Compute(ByVal polynomial As UInt32, ByVal seed As UInt32, ByVal buffer As Byte()) As UInt32
Return Not CalculateHash(InitializeTable(polynomial), seed, buffer, 0, buffer.Length)
End Function
Private Shared Function InitializeTable(ByVal polynomial As UInt32) As UInt32()
If polynomial = DefaultPolynomial AndAlso defaultTable IsNot Nothing Then
Return defaultTable
End If
Dim createTable As UInt32() = New UInt32(255) {}
For i As UInt32 = 0 To 255
Dim entry As UInt32 = DirectCast(i, UInt32)
For j As Integer = 0 To 7
If (entry And 1) = 1 Then
entry = (entry >> 1) Xor polynomial
Else
entry = entry >> 1
End If
Next
createTable(i) = entry
Next
If polynomial = DefaultPolynomial Then
defaultTable = createTable
End If
Return createTable
End Function
Private Shared Function CalculateHash(ByVal table As UInt32(), ByVal seed As UInt32, ByVal buffer As Byte(), ByVal start As Integer, ByVal size As Integer) As UInt32
Dim crc As UInt32 = seed
For i As Integer = start To size - 1
crc = (crc >> 8) Xor table(buffer(i) Xor crc And &HFF)
Next
Return crc
End Function
Private Function UInt32ToBigEndianBytes(ByVal x As UInt32) As Byte()
Return New Byte() {CByte(((x >> 24) And &HFF)), CByte(((x >> 16) And &HFF)), CByte(((x >> 8) And &HFF)), CByte((x And &HFF))}
End Function
End Class
Connect.registerUsers
utilise, I believe simplement normal MD5 hash comme implémenté dans le runtime .NET.
La page de documentation MD5 inclut même un exemple de code:
Function getMd5Hash(ByVal input As String) As String
' Create a new instance of the MD5 object. '
Dim md5Hasher As MD5 = MD5.Create()
' Convert the input string to a byte array and compute the hash. '
Dim data As Byte() = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input))
' Create a new Stringbuilder to collect the bytes '
' and create a string. '
Dim sBuilder As New StringBuilder()
' Loop through each byte of the hashed data '
' and format each one as a hexadecimal string. '
For i As Integer = 0 To data.Length - 1
sBuilder.Append(data(i).ToString("x2"))
Next
' Return the hexadecimal string. '
Return sBuilder.ToString()
End Function
Cependant, il y a une .NET client library pour Facebook, pourquoi ne pas l'utiliser?
Duh. La bibliothèque .NET ne prend pas en charge pour Connect
(encore)
- 1. fonction de courrier électronique
- 2. fonction d'envoi de courrier électronique deux fois
- 3. Facebook connect
- 4. Facebook Connect + MVC Modèle
- 5. Sauvegarde du courrier électronique
- 6. Lier Facebook Connect
- 7. analyse du courrier électronique
- 8. Comment obtenir page_id de la page facebook via facebook connect?
- 9. Facebook Connect + restful_authentication
- 10. Facebook Connect showFeedDialog
- 11. Déploiement avec SWFAddress et Facebook connect
- 12. Exception de connexion essayant d'envoyer un courrier électronique en Java
- 13. Visionneuse de courrier électronique HTML dans wxPython
- 14. Facebook Connect Questions de mise en œuvre
- 15. Facebook Connect sur iPhone question
- 16. Vidéo dans le courrier électronique?
- 17. DTS Envoyer une tâche de courrier électronique envoie deux fois le courrier électronique
- 18. Traitement du courrier électronique entrant
- 19. django facebook connect bibliothèques manquantes?
- 20. IE8 Win7 Facebook Connect Problème
- 21. Vérifier la signature Facebook Connect
- 22. Facebook connect et l'objet "session"
- 23. facebook connect javascript exemple disponible?
- 24. Fonction de hachage procédural
- 25. Facebook connect et les cookies tiers?
- 26. déclencher des fonctions avec facebook connect
- 27. iPhone développement - Contournement de l'authentification écran de Facebook Connect
- 28. Authentification de l'expéditeur de courrier électronique avec Postfix
- 29. Simple Facebook Connect Demo dans ASP.NET
- 30. Facebook Connect réponse en ignorant « next » paramètre
est-ce s'il vous plaît sendz le codez, bien que déguisé? ;) –