Android Century
  • Home
  • Android Zone
    • Android Apps
    • Android Games
    • Apps APk Files
    • Games Apk Files
    • Apps Hack Tricks
  • Reviews
  • Fantasy Zone
    • Entertainment
    • Quotes and Status
    • Life Style
    • Home Made Tips
    • Hair Care
    • Skin Care
    • Fantasy Tips
  • Tricks
    • Free Recharge
    • Free Internet
    • shopping Cashback
    • Recharge Cashback
  • Tech
  • Mobiles
  • Gadgets
  • News
  • How To's
  • Software
Breaking
Loading...

Featured post

How to Take Great Photos With Apple's iPhone X

Recent Posts

Labels

  • Android Apk Files
  • Android Apps
  • Android Games
  • Apps Apk Files
  • Entertainment
  • Fantasy Tips
  • Gadgets
  • Hair Care
  • HomeMade Tips
  • How To's
  • News
  • Quotes
  • Quotes & Status
  • Recharge Cashback
  • Recharge Promo Codes
  • Shopping Cashback
  • Technology
  • skin care
Home / How To's / Here is How to Convert String to Hexadecimal and Vice versa

Here is How to Convert String to Hexadecimal and Vice versa

Latest Govt. Jobs 22:08:00 How To's Edit
This article shows you how to convert string to hexadecimal and vice versa.
Image result for How to Convert String to Hexadecimal and Vice versaI did this program for my smart Card application. Earlier, I was using visual basic coding but this time I have to change my code into C#. Usually smart card application is writing data in hex format. I do not have a good hex converter to help me do those conversions that’s why I made this.


Using the code

The main code used for the conversion is from the Microsoft.VisualBasic class. Below is the code that is used to convert a string to hexadecimal format. We can’t direct convert all characters in to hexadecimal format (eg:@#$%^&*()) that’s why firstly I take ASCII value of the character, and then convert ASCII value into hexadecimal format.

//For this I made while loop
while (Data.Length > 0)
{
//first I take each character using substring
sValue= Data.Substring(0, 1).ToString()
//then convert character into ascii.
sValue= Strings.Asc(sValue)
//then convert ascii value into Hex Format
sValue = Conversion.Hex(sValue)
//after converting remove the character.
Data = Data.Substring(1, Data.Length – 1);
sHex = sHex + sValue;
}

Ony two functions I used for this application

Data_Hex_Asc(data)

(This Function for Converting data into hex format

public string Data_Hex_Asc(ref string Data)
{
string Data1 = “”;
string sData = “”;
while (Data.Length > 0)
//first take two hex value using substring.
//then convert Hex value into ascii.
//then convert ascii value into character.
{
Data1 = System.Convert.ToChar(System.Convert.ToUInt32(Data.Substring(0, 2), 16)).ToString();
sData = sData + Data1;
Data = Data.Substring(2, Data.Length – 2);
}
return sData;
}

Data_Asc_Hex(data)

(This Function for Converting hex into data )

public string Data_Asc_Hex(ref string Data)
{
//first take each charcter using substring.
//then convert character into ascii.
//then convert ascii value into Hex Format
string sValue;
string sHex = “”;
while (Data.Length > 0)
{
sValue = Conversion.Hex(Strings.Asc(Data.Substring(0, 1).ToString()));
Data = Data.Substring(1, Data.Length – 1);
sHex = sHex + sValue;
}
return sHex;
}
Share on Facebook Share on Twitter Share on Google Plus

RELATED POSTS


How to Get Free Internet on Idea An...

How to Use DroidVPN App For Free In...

How to HACK Google Play Music App
Here is How to Convert String to Hexadecimal and Vice versa Here is How to Convert String to Hexadecimal and Vice versa Reviewed by Latest Govt. Jobs on 22:08:00 Rating: 5

0 comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments ( Atom )

Search This Blog

TEST BOOK FOR GOVT ENTRANCE TEST

TEST BOOK FOR GOVT ENTRANCE TEST
Find All Latest book for preparation of SSC,RAILWAYBANK PO,RBI,BANK CLERK,GATE ME,GATE CE are available here in less prices, to check out the books click here

Translate

  • Popular Post
  • Random posts
  • Category

Popular Posts

  • Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Refer & Earn Offer:  Hey Guys! Today I make an article about Teen Patti Referral ...
  • KingRoot 4.8.1 (136) APK Latest Version Download
    Download KingRoot Latest Version 4.8.1 In Tools by Developer KingRoot Studio ( 4.x / 5  average ...
  • 11 things you should understand approximately iOS 11
    Apple introduced the following version of its running system for the iPhone and iPad, iOS eleven ...
  • How to Upload Your Music Library to Google Play Music
    Google Play Music offers an unlimited music streaming subscription paired with YouTube Red ...
  • How to Disable Your Mac’s Touchpad When Another Mouse Is Connected
    Laptop trackpads can be annoying. Your palm hits them while you’re typing, moving your cursor ...
  • How to Gain Root Access of An Android Device via KingoRoot Software
    What Does Root Access Mean? Gaining root access of Android is the process of modifying the ...

Random Posts

  • Pixel and Pixel XL owners suing Google over microphone defect issues
    Pixel and Pixel XL owners suing Google over microphone defect issues
    08.02.2018 - 0 Comments
    Google has been slapped with a class-action lawsuit over microphone defects in the Pixel and Pixel XL…
  • How to Clear Your Cache on Any Browser
    How to Clear Your Cache on Any Browser
    11.02.2017 - 0 Comments
    The browser history—a list of every page you've visited online and the time you were there—is a…
  • iPhone 8 vs iPhone 8 Plus
    iPhone 8 vs iPhone 8 Plus
    23.09.2017 - 0 Comments
    iPhone 8 vs iPhone 8 Plus: Which Apple phone is the better iPhone 7 upgrade? We didn’t hide our opinion…
  • Moto X5, Moto G6 series, Moto Z3 mobiles leaked ahead of MWC 2018
    Moto X5, Moto G6 series, Moto Z3 mobiles leaked ahead of MWC 2018
    18.01.2018 - 0 Comments
    Motorola is expected to showcase a slew of new smartphones in its Z, G, and X series, at the…
  • JOBS-  SAP India's new programme aims to bring 'women back to workplace'
    JOBS- SAP India's new programme aims to bring 'women back to workplace'
    10.11.2016 - 0 Comments
    NEW  DELHI: Enterprise software maker SAP has launched an initiative called…

Labels

Android Apk Files Android Apps Android Games Apps Apk Files Apps Hack Tricks Entertainment Free Internet Freecharge Gadgets Games Apk Files How To's Laptops Guide Mobiles Reviews Technology Viral's android zone free recharge

Entertainment

Tricks

Popular Posts

  • Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Refer & ...
  • Researchers trick 'CEO' email scammer into giving up identity
    Businesses ...
  • How to Gain Root Access of An Android Device via KingoRoot Software
    What Does Root ...
  • Tinyowl Freecharge Offer – Get 15% Cashback + extra 25% cashback using Freecharge [Ultimatez Tricks]
    Tinyowl Freecharge ...
  • How to Disable Your Mac’s Touchpad When Another Mouse Is Connected
    Laptop ...
  • Infocus Vision 3 review
    What happens when ...
  • EVGA redesigns its graphics cards following overheating concerns
    Following a ...

Random Posts

  • Apple's MEGA Plans For 2017 iPad Pro 2 REVEALED: ZERO Bezels, OLED Display Rumoured
    Apple's MEGA Plans For 2017 iPad Pro 2 REVEALED: ZERO Bezels, OLED Display Rumoured
    11.02.2017 - 0 Comments
    Apple's iPad Pro 2 will now launch inside Q1 2017, alongside two other models The original…
  • How to use all the new messages features in iOS 10
    How to use all the new messages features in iOS 10
    06.11.2016 - 0 Comments
    Instant messaging is a very competitive space. With the rise of WhatsApp, its acquisition by Facebook,…
  • Newegg's dropped $20 off the 0.33-technology Nest thermostat
    Newegg's dropped $20 off the 0.33-technology Nest thermostat
    25.03.2017 - 0 Comments
    Newegg has a deal that offers a smarter way to turn down the heat as we move from winter to spring. The…
  • How to hack a phone with sound waves
    How to hack a phone with sound waves
    15.03.2017 - 0 Comments
    A security loophole that would allow someone to add extra steps to the counter on…
  • Aadhaar will soon be mandatory for booking train tickets online
    Aadhaar will soon be mandatory for booking train tickets online
    03.03.2017 - 0 Comments
    The Railways will soon move towards Aadhaar-based online ticketing system to prevent touts from…

Most Popular

  • Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Refer & ...
  • SAMSUNG GALAXY J7 (2016) REVIEWS
    SAMSUNG GALAXY J7 (2016) REVIEWS
    SAMSUNG GALAXY J ...
  • Top 5 Best SmartPhones under 7000 Rs (March 2017)
    Looking for the ...
  • Apple, IBM, Cisco are huge because of Indians, do not deny them H-1B visa: RBI Governor Urjit Patel
    ...
  • SAMSUNG GALAXY J7 (2016) Specifications
    SAMSUNG GALAXY J ...
  • BlackBerry Teases Marshmallow Beta Testing for Priv by Next Week
    Blackberry ...
  • LG Q6 Review
    LG Q6 Review
    2017 is ...

Contact Form

Name

Email *

Message *

Offers Zone

Created By Android Century Distributed by Android Century
  • Home
  • About us
  • Contact us
  • Privacy policy
  • Terms of use
  • Advertise here
Subscribe Via Email Subscribe To Android Century By Email And Get Free Updates. ;-)


Your email address is safe with us!