Skip Menu |

This queue is for tickets about the Convert-Base32 CPAN distribution.

Report information
The Basics
Id: 53015
Status: resolved
Priority: 0/
Queue: Convert-Base32

People
Owner: IKEGAMI [...] cpan.org
Requestors: IKEGAMI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.02
Fixed in: 0.03



Subject: Uppercase letters are rejected by decode_base32
Uppercase letters are rejected by decode_base32 The following code should address that and should be faster. However, I neither tested it nor benchmarked it. sub decode_base32($) { my $str = shift; my $init_len = length($str); $str =~ tr/a-z2-7A-Z/\x00-\x1F\x00-\x19/d; Carp::croak('Data contains non-base32 characters') if length($str) != $init_len; $str = unpack('B*', $str); $str =~ s/.{3}(.{5})/$1/sg; pos($str) = int(length($str) / 8); Carp::croak('Data incorrectly padded (too much or non-zero)') if $str !~ s/\G0{0,4}\z//gs; return pack('B*', $str); }