Skip Menu |

This queue is for tickets about the Math-BigInt CPAN distribution.

Report information
The Basics
Id: 119096
Status: resolved
Priority: 0/
Queue: Math-BigInt

People
Owner: Nobody in particular
Requestors: felipe [...] felipegasper.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Feature request: as_byte_string()
Date: Fri, 2 Dec 2016 03:05:10 -0500
To: bug-math-bigint [...] rt.cpan.org
From: Felipe Gasper <felipe [...] felipegasper.com>
sub as_byte_string { my ($self) = @_; my $hex = $self->as_hex(); $hex =~ s<\A0x><>; #Ensure that we have an even number of hex digits. if (length($hex) % 2) { substr($hex, 0, 0) = '0'; } return pack 'H*', $hex; } I’m sure there’s a more efficient means of doing this than the above! It’s useful for crypto stuff and would be great to have upstream. Thanks! -Felipe Gasper Mississauga, Ontario
Implemented as_bytes() and from_bytes() in Math::BigInt v1.999804. Currently, only big endian byte order is supported.