|
|
|
|
|
|
w*s 发帖数: 7227 | 1 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 ? | t****t 发帖数: 6806 | 2 $ perl -MMath::BigInt -e '$a=Math::BigInt->from_hex("
D55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C")>>3; print $a->
as_hex, "\n";'
0x1aab488b4119258241042db22d5b0739ce739820828232487ffce16227
D55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C"
【在 w*s 的大作中提到】 : 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 ?
| t****t 发帖数: 6806 | 3 or even easier, write
$ perl -Mbigint -e '$a=
0xD55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C>>3; print $a->
as_hex, "\n";'
0x1aab488b4119258241042db22d5b0739ce739820828232487ffce16227
D55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C"
【在 w*s 的大作中提到】 : 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 ?
| w*s 发帖数: 7227 | 4 厉害,谢谢!
【在 t****t 的大作中提到】 : or even easier, write : $ perl -Mbigint -e '$a= : 0xD55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C>>3; print $a-> : as_hex, "\n";' : 0x1aab488b4119258241042db22d5b0739ce739820828232487ffce16227 : : D55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C"
| l********a 发帖数: 1154 | 5 跟python一样方便
>>> str(hex(0xD55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C>>3))
'0x1aab488b4119258241042db22d5b0739ce739820828232487ffce16227L'
>>> str(hex(0xD55A445A08C92C1208216D916AD839CE739CC10414119243FFE70B113C>>3)
)[:-1]
'0x1aab488b4119258241042db22d5b0739ce739820828232487ffce16227' |
|
|
|
|
|
|