We have a few of these on the forum, but I wanted something that was a bit speedier than the versions I currently have.
This'll still be hellishly slower than doing it via DLL, but if you're in a bind.

Code:
Function HexToBinary Global String sInp Returns UChar[]
    UChar[] aTemp 
    UChar[] aRet
    Integer iPos 
    Integer iMax 
    Integer iNext 
    
    Move (StringToUCharArray(sInp)) to aTemp
    Move (SizeOfArray(aTemp)) to iMax
    
    For iPos from 0 to (iMax-1)  
        If ((aTemp[iPos] >= 48) and (aTemp[iPos] <= 57)) Begin 
            Move (aTemp[iPos] - 48) to aTemp[iPos]
        End
        Else If ((aTemp[iPos] >= 97) and (aTemp[iPos] <= 102)) Begin 
            Move (aTemp[iPos] - 87) to aTemp[iPos]
        End
        Else If ((aTemp[iPos] >= 65) and (aTemp[iPos] <= 70)) Begin 
           Move (aTemp[iPos] - 55) to aTemp[iPos]
        End
        Else Begin 
            Move 0 to aTemp[iPos]
        End
        
    Loop 

    For iPos from 0 to (iMax-2)
        If ( (mod(iPos,2)) = 0) Begin 
            Move ((aTemp[iPos] * 16) + aTemp[iPos+1]) to aRet[iNext]
            Move (iNext+1) to iNext 
        End
    Loop   

    Function_Return aRet 
    
End_Function