Home: Perl Programming Help: Beginner:
Interesting question, how do you bitwise shift a long hex string ?



ningji
User

Jan 4, 2013, 12:32 PM


Views: 1768
Interesting question, how do you bitwise shift a long hex string ?

say this is encryption, i have a key like this,
my $hexString = "D55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C";

now i need to get rid of the last 3 bits,
basically

$newHexString = $hexString >> 3.

how can you do that in perl ?


FishMonger
Veteran / Moderator

Jan 4, 2013, 1:03 PM


Views: 1761
Re: [ningji] Interesting question, how do you bitwise shift a long hex string ?

You'll want to use a combination of the hex() and sprintf() or printf() functions.

You will probably also need to use Math::BigInt or one of its brothers.


ningji
User

Jan 14, 2013, 8:39 AM


Views: 1712
Re: [FishMonger] Interesting question, how do you bitwise shift a long hex string ?

BigInt is the one, thx !


In Reply To
You'll want to use a combination of the hex() and sprintf() or printf() functions.

You will probably also need to use Math::BigInt or one of its brothers.