cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

HEX to String

Former Member
0 Likes
932

Hi all,

I need to convert a HEX to string for X509 certificate serial number. Anyone have a simple function for this.

Right now I'm using MS SQL Server to do the conversion but would love to do it client side.

SELECT CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX), '0x3030303031303030303030323031303633393638', 1))


I'm using PB 12.5.1

Regards,

Adrian

View Entire Topic
Former Member
0 Likes

I'm sorry, Adrian, I'm not clear what data type variable you have that in, in PB. One would need that information to offer an answer.

Former Member
0 Likes

Dan,

I'm sorry. I'm calling an API that is returning a string with a HEX value. I need to convert that string with the HEX value to regular ascii string.

As I mention my first post I'm using a varchar on SQL Server to convert the varchar by only putting in front 0x so that SQL Server takes it as a HEX value.

If I use the following syntax PB will give me an error.

ls_hex = "~h"+ls_string

Regards,

Adrian

Former Member
0 Likes

OK, Adrian, I'm still confused I'm afraid. A hex string is a string, and it is certainly ASCII. So what do you really mean? Do you mean convert a hex number (of how many digits?) to a long (perhaps very long?) integer, and then represent that as a string?

Perhaps you could give a simple specific example of what should be converted to what.

If others are clearer on this than I am, do jump in.