Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add two hex numbers?

Status
Not open for further replies.

CFtaxtron

Programmer
May 26, 2001
19
CA
I need to add two hex numbers together and having a problem I can't figure it out

$digest = md5_hex("qawsedr");
$digest1=$digest+33C93DC8827080D429A127089CEC3745;
$digest2 = md5_hex($digest1);

I get the error message

Bareword found where operator expected at C:\Inetpub\ line 7, near "33C93DC8827080D429A127089CEC3745"
(Missing operator before C93DC8827080D429A127089CEC3745?)

Is there anything special I have to do to add two hex numbers together.

Thanks

Tim
 
Do you really need to ADD them together, or could you just OR them? If you really need to add them (arithmetically) you'll have to pack them into a real number, then add them, then unpack them again. Otherwise perl treats hex numbers as strings.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thank you, thats what I wanted to do. Got so deep into this project my brain is turning to jello.

Thanks

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top