use strict; use warnings; use Data::Dump; use Math::BigInt; my $string = '1677259342285725925376'; my $n = Math::BigInt->new($string); my @bytes = map { ord } split //, $n->to_bytes(); @bytes = map { $_ >= 128 ? $_ - 256 : $_ } @bytes; dd \@bytes; #### 16:16 >perl 2015_SoPW.pl [90, -20, -90, 53, 78, -38, 2, -128, 0] 16:16 >