有沒有人有一個工作班或功能來創建發送到Facebook的散列電子郵件註冊與connect.registerUsers電子郵件地址?Facebook連接電子郵件散列函數爲vb.net
0
A
回答
0
想通了這一點對我自己
進口System.Net
進口tb2CoreLib
進口Microsoft.Xml.Schema。 LINQ
進口System.Security.Cryptography
進口facebook.Uti lity
進口Microsoft.Xml
進口的System.Xml
進口的System.Web
公共類FacebookConnect
公共功能EmailHash(BYVAL電子郵件作爲字符串)作爲字符串
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
最終等級
進口系統
進口System.Security.Cryptography
公共類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
末級
1
Connect.registerUsers
使用,I believe只是在.NET運行時中實現的normal MD5 hash。
的MD5文檔頁面甚至還包括一個示例代碼:
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
然而,還有對於Facebook一.NET client library無論如何,爲什麼不利用呢?
Duh。的.NET庫沒有對Connect
(還)支持
相關問題
- 1. Gravatar電子郵件散列函數
- 2. 獲取Facebook電子郵件/電子郵件散列
- 3. facebook連接和用戶電子郵件
- 4. Facebook連接,電子郵件地址?
- 5. VB.net接收電子郵件
- 6. 使用sha256計算電子郵件散列的電子郵件
- 7. 散列/電子郵件加密
- 8. 獲取我的Facebook連接的電子郵件Hashes我的Facebook連接
- 9. vb.net發送電子郵件
- 10. VB.Net電子郵件發送
- 11. Facebook Connect - 接收電子郵件屬性
- 12. Windows活動API獲取電子郵件聯繫與電子郵件散列
- 13. Facebook的連接,獲得的電子郵件
- 14. iPhone facebook連接電子郵件返回null
- 15. Facebook連接:發送電子郵件到代理地址?
- 16. Facebook連接codeigniter獲取用戶的電子郵件
- 17. vb.NET SmtpClient無法使用電子郵件發送電子郵件
- 18. 開源庫爲Facebook,電子郵件,IM
- 19. Facebook分享電子郵件
- 20. facebook不給電子郵件
- 21. 不接收來自PHP郵件()函數的電子郵件
- 22. 調試電子郵件連接
- 23. java電子郵件連接方法
- 24. CakePHP的電子郵件連接Office365
- 25. SMTP連接超時PHP電子郵件
- 26. 發送電子郵件:未能連接
- 27. 通過Ruby連接到電子郵件
- 28. Linkedin連接電子郵件地址
- 29. 通過resque發送電子郵件:對象視爲散列
- 30. 爲什麼Gravatar需要你散列電子郵件?
是這樣,請sendz的codez,雖然僞裝? ;) – 2009-09-17 07:52:27