sub bigint_to_bytearray { my $bigint = shift; my @bytes; while(1) { push(@bytes,($bigint & 255)); $bigint->brsft(8); last if $bigint == 0; } return @bytes; }