Solved

How to convert a alpha numeric string into Hex

Posted on 2009-07-13
6
767 Views
Last Modified: 2012-05-07
I have a alpha numeric serial number "0013a200402c4bca" and I want to convert it into hex?
any ideas?
0
Comment
Question by:cmdolcet
6 Comments
 
LVL 18

Expert Comment

by:Ajay Sharma
Comment Utility
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
Try with the following:

Dim test as String = "0013a200402c4bca"
Dim num as Int64
num = Convert.ToInt64(test, 16)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
Notice that a regular Integer (Int32) cannot contain such large number.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:cmdolcet
Comment Utility
jaime_olivares, the alpha string im trying to convert i want it in an array

so the string"0013a200402c4bca"
how can i break this up into array section
(0) = 00
(1)=13
(2)=a2
(3)=00
(4)=40
(5)=2c
(6)=4b
(7)=ca

then convert this to hex value?
Sorry i should have been clear when i originally asked the question
0
 
LVL 8

Expert Comment

by:bhmahler
Comment Utility
That value is already in hex. It is an 8 bytes int64  if you want to get the value of it numerically you can use something like this.

Dim result As Int64 = Int64.Parse("0013a200402c4bca", Globalization.NumberStyles.HexNumber)

Open in new window

0
 
LVL 8

Accepted Solution

by:
bhmahler earned 500 total points
Comment Utility
You can also use bitconverter to break the number back into the hex string
BitConverter.ToString(BitConverter.GetBytes(result), 0))

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now