Private Const CRYPT_STRING_NOCR As Long = &H80000000
Private Const CRYPT_STRING_NOCRLF As Long = &H40000000
Private Const CRYPT_STRING_HEX As Long = 4&
Private Declare Function CryptBinaryToString Lib "Crypt32" Alias "CryptBinaryToStringW" (ByRef pbBinary As Byte, ByVal cbBinary As Long, ByVal dwFlags As Long, ByVal pszString As Long, ByRef pcchString As Long) As Long
Private Declare Function CryptStringToBinary Lib "Crypt32" Alias "CryptStringToBinaryW" (ByVal pszString As Long, ByVal cchString As Long, ByVal dwFlags As Long, ByVal pbBinary As Long, ByRef pcbBinary As Long, ByRef pdwSkip As Long, ByRef pdwFlags As Long) As Long
Private Declare Function ArrPtr Lib "msvbvm60" Alias "VarPtr" (Arr() As Any) As Long
Private Declare Sub PutMem4 Lib "msvbvm60" (ByVal Ptr As Long, ByVal Value As Long)
Private Declare Function SysAllocStringByteLen Lib "oleaut32" (ByVal Ptr As Long, ByVal Length As Long) As Long
Private Declare Function SysAllocStringLen Lib "oleaut32" (ByVal Ptr As Long, ByVal Length As Long) As Long
Private LH(0 To 5) As Long, LHP As Long
Private LA() As Long, LP As Long
Public Function BytesToHexString_C1(Bytes() As Byte, Optional ByVal Format As Boolean = True, Optional ByVal NewLine As Boolean = True, Optional ByVal Lowercase As Boolean = True) As String
Dim F As Long, L As Long, LB As Long, P As Long, UB As Long
P = Not Not Bytes: Debug.Assert App.hInstance
If P <> 0 Then
LB = LBound(Bytes)
UB = UBound(Bytes) + 1
If UB > LB Then
F = CRYPT_STRING_HEX Or (CLng(Not Format Or Not NewLine) And (CRYPT_STRING_NOCR Or CRYPT_STRING_NOCRLF))
If CryptBinaryToString(Bytes(LB), UB, F, 0, L) <> 0 Then
P = SysAllocStringLen(0, L - 1)
PutMem4 VarPtr(BytesToHexString_C1), P
If CryptBinaryToString(Bytes(LB), UB, F, P, L) <> 0 Then