Imports System.Security.Cryptography
Console.WriteLine(EncryptPlayerID(1))
Private Function GetEncryptionKey() As Byte()
Dim arrResult(23) As Byte
Dim strKey As String = "E37CF171E76AD4CD2FF50BD777DFF4E35A319AF27091E10015805791476B38CF044B79DDFD640EDF56C08EEEF61CE925474783C84A81615199F15C67124286C3BC3AD32B6517E5F423B99BAF03F208F795324A00E76E8482E928430C08A6CD1339C931BC48BDBE2F608EA590E4B04EA5E863D0DF"
For intIndex As Integer = 0 To 23
arrResult(intIndex) = Byte.Parse(strKey.Substring(intIndex * 8, 2), Globalization.NumberStyles.HexNumber)
Public Function EncryptPlayerID(ByVal pDecryptedValue As Integer) As String
Return GetHexadecimalString(TripleDESEncryptInteger(pDecryptedValue, GetEncryptionKey())).ToUpper()
Public Function GetHexadecimalString(ByVal ParamArray pByteArray As Byte()) As String
Dim strResult As String = ""
For Each b As Byte In pByteArray
strResult &= b.ToString("x2")
Return strResult.ToUpper()
Private Function TripleDESEncryptInteger(ByVal pValue As Integer, ByVal pKey() As Byte) As Byte()
Dim arrInputBytes(3) As Byte
For intIndex As Integer = 0 To 3
arrInputBytes(intIndex) = CByte(pValue >> (8 * intIndex) And &HFFI)
Return TripleDESTransform(arrInputBytes, pKey, False)
Private Function TripleDESTransform(ByVal pInput() As Byte, ByVal pKey() As Byte, ByVal pIsInputEncrypted As Boolean) As Byte()
Dim arrResult() As Byte = Nothing
Using objProvider As New TripleDESCryptoServiceProvider()
objProvider.Mode = CipherMode.ECB
objProvider.Padding = PaddingMode.PKCS7
objProvider.BlockSize = 64
objProvider.KeySize = pKey.Length * 8
Using objTransform As ICryptoTransform = If(pIsInputEncrypted, objProvider.CreateDecryptor(), objProvider.CreateEncryptor())
arrResult = objTransform.TransformFinalBlock(pInput, 0, pInput.Length)