Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: String to Hex

by BrowserUk (Patriarch)
on May 22, 2007 at 21:19 UTC ( #616875=note: print w/replies, xml ) Need Help??


in reply to String to Hex

For numbers upto 2**53 (~16 decimal digits), you could use this:

sub hexFromI53{ my $n = shift; my $lo = $n % ( 2**32 ); my $hi = int( $n / 2**32 ); return sprintf "%x%08x", $hi, $lo; };; print hexFromI53( 24600988483 );; 5ba554b43 print hexFromI53( 9_007_199_254_740_992 );; 20000000000000

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://616875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-01-18 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (52 votes). Check out past polls.

    Notices?