note 91091 deleted from mcrypt.examples by danbrown
| From: | danbrown@php.net | Date: | Mon, 25 May 2009 22:08:35 +0000 |
| Subject: | note 91091 deleted from mcrypt.examples by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155971@lists.php.net to get a copy of this message | ||
Note Submitter: ricbalda at hotmail dot com
Reason: non-english
----
Hola por espacio no fue posible poner todo el codigo VB9, aqui unas rutinas que faltaban
Codigo VB9
''' <summary>
''' HexToBytes: Converts a hex-encoded string to a byte array
''' </summary>
''' <param name="Hex"></param>
''' <returns></returns>
''' <remarks></remarks>
Private Shared Function HexToBytes(ByVal Hex As String) As Byte()
Dim numBytes As Integer = Hex.Length / 2
Dim bytes(numBytes - 1) As Byte
For n As Integer = 0 To numBytes - 1
Dim hexByte As String = Hex.Substring(n * 2, 2)
bytes(n) = Integer.Parse(hexByte, Globalization.NumberStyles.HexNumber)
Next
Return bytes
End Function
''' <summary>
''' BytesToHex: Converts a byte array to a hex-encoded string
''' </summary>
''' <param name="bytes"></param>
''' <returns></returns>
''' <remarks></remarks>
Private Shared Function BytesToHex(ByVal bytes() As Byte) As String
Dim hex As New StringBuilder
For n As Integer = 0 To bytes.Length - 1
hex.AppendFormat("{0:X2}", bytes(n))
Next
Return hex.ToString
End Function
Saludos
Ricardo Balda