home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "Utility"
- Option Explicit
-
- Public Enum enuHashingMethod
- ehmSHA = 0
- ehmHaval = 1
- End Enum
-
- ' Convert the variant specified to an hexadecimal representation, only if
- ' the variant is an array.
- Public Function BinaryToHex(ByRef vaBinaryValue As Variant) As String
-
- Dim I As Long
- Dim sNewValue As String
-
- sNewValue = ""
-
- If (VarType(vaBinaryValue) And vbArray) = vbArray Then
- For I = 0 To LenB(vaBinaryValue) - 1
- sNewValue = sNewValue & Right("0" & Hex(CLng(vaBinaryValue(I))), 2)
- Next I
- End If
-
- BinaryToHex = sNewValue
-
- End Function
-
- ' Convert the hexadecimal string to a byte array return as a variant
- Public Function HexToBinary(ByRef sHexValue As String) As Variant
-
- Dim I As Long
- Dim NewValue() As Byte
-
- I = 0
- While I < Len(sHexValue)
- ReDim Preserve NewValue(I / 2)
- NewValue(I / 2) = Val("&H" & Mid$(sHexValue, I + 1, 2))
- I = I + 2
- Wend
-
- HexToBinary = NewValue
-
- End Function
-
-