Corrected encoding of large exponent and read from stdin. use MIME::Base64;
print "exponent: "; $exponent = <>; print "mantisa: "; $mantisa = <>; # strip white space $exponent =~ s/\s//g; $mantisa =~ s/\s//g; #convert to binary $exponent = pack("H*", $exponent); $mantisa = pack("H*", $mantisa); $data = ''; if (length($exponent) < 256) { $data .= pack("C", length($exponent)); } elsif (length($exponent) < 0xffff) { $data .= pack("CCn", 0, 2, length($exponent)); } elsif (length($exponent) < 0xffffff) { $data .= pack("CCn", 0, 3, length($exponent)); } else { $data .= pack("CCn", 0, 4, length($exponent)); } $data .= $exponent; $data .= $mantisa; print encode_base64($data)."\n"; -- Mark Andrews, ISC 1 Seymour St., Dundas Valley, NSW 2117, Australia PHONE: +61 2 9871 4742 INTERNET: ma...@isc.org _______________________________________________ Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users