view release on metacpan or search on metacpan
tests/include/pdclib/functions/_PDCLIB/_PDCLIB_strtox_prelim.c view on Meta::CPAN
}
}
else if ( *base == 0 )
{
*base = 8;
/* back up one digit, so that a plain zero is decoded correctly
(and endptr is set correctly as well).
(2019-01-15, Giovanni Mascellani)
*/
--p;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/BulkDecoder.pm view on Meta::CPAN
my ($ydec_part, $ydec_line, $ydec_size, $ydec_name, $ydec_pcrc,
$ydec_begin, $ydec_end);
my $pcrc;
while ( $_ = shift(@lines) ) {
# Newlines a fakes and should not be decoded.
chomp;
s/\r//g;
# If we've started decoding $ydec_name will be set.
if ( !$ydec_name ) {
# Skip until beginning of yDecoded part.
lib/Convert/BulkDecoder.pm view on Meta::CPAN
# Looking for the end tag.
if ( /^=yend/ ) {
# We are done.. Check the sanity of article.
# and unset $ydec_name in case that there are more
# ydecoded files in the same article.
$self->{result} = "OK";
if ( / part=(\d+)/ ) {
if ( $ydec_part != $1 ) {
die("Part number '$1' different from beginning part '$ydec_part'\n");
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/PEM.pm view on Meta::CPAN
I<Name> is a required argument.
=item * ASN
An ASN.1 description of the content to be either encoded or decoded.
I<ASN> is an optional argument.
=item * Macro
lib/Convert/PEM.pm view on Meta::CPAN
=back
=head2 $obj = $pem->decode(%args)
Decodes, and, optionally, decrypts a PEM file, returning the
object as decoded by I<Convert::ASN1>. The difference between this
method and I<read> is that I<read> reads the contents of a PEM file
on disk; this method expects you to pass the PEM contents as an
argument.
If an error occurs while reading the file or decrypting/decoding
lib/Convert/PEM.pm view on Meta::CPAN
=back
=head2 $obj = $pem->read(%args)
Reads, decodes, and, optionally, decrypts a PEM file, returning
the object as decoded by I<Convert::ASN1> (or binary blob if ASN.1
description was not provided). This is implemented as a wrapper
around I<decode>, with the bonus of reading the PEM file from disk
for you.
If an error occurs while reading the file or decrypting/decoding
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/PerlRef2String.pm view on Meta::CPAN
}
sub string2perlref {
my $string = shift;
return unless(defined $string);
my($decoded,$perlref,$VAR1);
eval{$decoded = decode_base64($string);};
die $! if($@);
$perlref = eval($VAR1 = Compress::Zlib::memGunzip($decoded));
die $! if($@);
return $perlref;
}
sub string2perlcode {
my $string = shift;
return unless(defined $string);
my($decoded,$perlcode);
eval{$decoded = decode_base64($string);};
die $! if($@);
eval {$perlcode = Compress::Zlib::memGunzip($decoded);};
die $! if($@);
return $perlcode;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
close $fh;
# Decode the JSON text as an array
my $json_array = decode_json($json_text);
# Return the first element if the decoded JSON is an array
return
ref $json_array eq 'ARRAY'
? $json_array->[0]
: die "Expected a JSON array in $filename";
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/RACE.pm view on Meta::CPAN
# 2.3.1 Strip the "bq--"
$str =~ s/^$_prefix_tag// or Carp::croak("String not begin with $_prefix_tag");
# 2.3.2 Decode the stripped string with Base32
my $decoded = decode_base32($str);
# 2.3.3 Decompress the decoded string
my $decompressed = _decompress($decoded);
# 2.3.4 Check the internationalized string for disallowed names
unless (_include_disallowed_names($decompressed)) {
Carp::croak('Decoded string includes no internationalized characters');
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/TLI.pm view on Meta::CPAN
use Convert::TLI;
my $tli = Convert::TLI->new();
my ($ip, $port) = $tli->decode_tli('0x0002333337f00001');
print "Server $ip @ $port";
my $decoded = $tli->encode_tli($ip,$port);
print "Got encoded: $decoded";
=head1 DESCRIPTION
This module provides functions to convert strings to/from the TLI style encoding
as described L<infocenter.sybase.com|http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc35823.1572/doc/html/san1334282782407.html>
lib/Convert/TLI.pm view on Meta::CPAN
Possible options:
C<prefix> and C<nulls>
It will be the prefix and suffix for encripted line only
my $encoded = Convert::TLI->new( prefix=>'XXXX', nulls=>'000' );
my $decoded = $tli_decoded->encode_tli($ip,$port);
print "Got encoded: $decoded";
XXXX....000
=item *
C<encode_tli>
lib/Convert/TLI.pm view on Meta::CPAN
=item *
C<detect_tli>
my $decoded = ( detect_tli("0x0002333337f00001") )
? 'You have TLI style'
: 'Regular IP style';
Detect is string TLI styled
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/rfc1345 view on Meta::CPAN
facility that within the relevant parts of the message, encoded in an
ordinary coded character set, text may have occurrences of the
following sequence: an intro character sequence, followed by a string
of characters that represent a character mnemonic, as described
below. Similarly, the intro character sequence may be doubled,
indicating a single occurrence of the respective symbols in decoded
format.
Note that many characters within a mnemonic character set may be
represented in two different ways. Normally the character itself is
used, but it is also possible to use the mnemonic allocated to the
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/UU.pm view on Meta::CPAN
C<end>. Second and third argument are optional and specify filename and
mode. If unspecified these default to "uuencode.uu" and 644.
=item * uudecode
uudecode() takes a string as argument which will be uudecoded. If the
argument is a filehandle this handle will be read instead. If it is a
reference to an ARRAY, the elements are treated like lines that form a
string. Leading and trailing garbage will be ignored. The function
returns the uudecoded string for the first begin/end pair. In array
context it returns an array whose first element is the uudecoded
string, the second is the filename and the third is the mode.
=back
=head1 EXPORT
view all matches for this distribution
view release on metacpan or search on metacpan
FILE_NOBEGIN No 'begin' found
FILE_NOEND No 'end' found
FILE_NODATA File does not contain valid uudata
FILE_OK All Parts found, ready to decode
FILE_ERROR Error while decoding
FILE_DECODED Successfully decoded
FILE_TMPFILE Temporary decoded file exists
=head2 Encoding types
UU_ENCODED UUencoded data
B64_ENCODED Mime-Base64 data
=over
=item $retval = $item->rename ($newname)
Change the ondisk filename where the decoded file will be saved.
=item $retval = $item->decode_temp
Decode the file into a temporary location, use C<< $item->infile >> to
retrieve the temporary filename.
=item $retval = $item->remove_temp
Remove the temporarily decoded file again.
=item $retval = $item->decode ([$target_path])
Decode the file to its destination, or the given target path.
{
partno => <integer describing the part number, starting with 1>,
# the following member sonly exist when they contain useful information
sfname => <local pathname of the file where this part is from>,
filename => <the ondisk filename of the decoded file>,
subfname => <used to cluster postings, possibly the posting filename>,
subject => <the subject of the posting/mail>,
origin => <the possible source (From) address>,
mimetype => <the possible mimetype of the decoded file>,
mimeid => <the id part of the Content-Type>,
}
Usually you are interested mostly the C<sfname> and possibly the C<partno>
and C<filename> members.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/X509/Parser.pm view on Meta::CPAN
sub _decode {
die ("Error\n",$asn->error,"\nin ASN.1 code ") if $asn->error;
my $type = shift;
my $node= $asn->find( $oid_db{uc($type)}->{'asn'} || 'Any' );
die ('Error finding ',$type,'-', $oid_db{uc($type)}->{'asn'}, ' in module') unless $node;
my @decoded = map {$node->decode($_)} @_;
return ( @_ > 1 ? [@decoded] : $decoded[0] )
}
sub _decode_rdn {
my $res = {};
return $res unless ref($_[0]) eq 'ARRAY';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/XText.pm view on Meta::CPAN
use Convert::XText;
my $encoded = Convert::XText::encode_xtext('String to=encode');
# $encoded contains "String+20to+3Dencode"
my $decoded = Convert::XText::decode_xtext($encoded);
# $decoded contains 'String to=encode'
=head1 DESCRIPTION
RFC1891 defines the xtext encoding for delivery service notifications,
to encode non-standard-ascii characters and special chars in a simple
lib/Convert/XText.pm view on Meta::CPAN
Expects a non-unicode-string to encode in xtext encoding. Returns
the encoded text.
=item decode_xtext ($string_to_decode)
Expects an xtext-encoded string and returns the decoded string.
=back
=head2 EXPORT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/YText.pm view on Meta::CPAN
=head1 SYNOPSIS
use Convert::YText qw(encode_ytext decode_ytext);
$encoded=encode_ytext($string);
$decoded=decode_ytext($encoded);
($decoded eq $string) || die "this should never happen!";
=head1 DESCRIPTION
Convert::YText converts strings to and from "YText", a format inspired
by xtext defined in RFC1894, the MIME base64 and quoted-printable
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/Z85.pm view on Meta::CPAN
=head1 SYNOPSIS
use Convert::Z85;
my $encoded = encode_z85($binarydata);
my $decoded = decode_z85($encoded);
=head1 DESCRIPTION
An implementation of the I<Z85> encoding scheme (as described in
L<ZeroMQ spec 32|http://rfc.zeromq.org/spec:32>) for encoding binary data as
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Convert/yEnc/Decoder.pm view on Meta::CPAN
=head1 DESCRIPTION
C<Convert::yEnc::Decoder> decodes a yEncoded file and writes it to disk.
Methods are provided for returning information about the decoded file.
=head2 Exports
Nothing.
lib/Convert/yEnc/Decoder.pm view on Meta::CPAN
returns the complete path of the file that was created.
=item I<$size> = I<$decoder>->C<size>
After a successful decode,
returns the size of the decoded file.
=item I<$ybegin> = I<$decoder>->C<ybegin>
After a successful decode,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cookie/Domain.pm view on Meta::CPAN
}
my $code = $resp->code;
# try-catch
my $data = eval
{
$resp->decoded_content( default_charset => 'utf-8', alt_charset => 'utf-8' );
};
if( $@ )
{
return( $self->error( "Error decoding response content: $@" ) );
}
lib/Cookie/Domain.pm view on Meta::CPAN
=head2 decode
Takes a domain name, or rather called a host name, such as C<www.æ±äº¬.jp> or C<ä»ä½å¹´.jp> and this will return its punycode ascii representation prefixed with a so-called ASCII Compatible Encoding, a.k.a. C<ACE>. Thus, using our previous example...
Even if the host name contains non-ascii dots, they will be recognised. For example C<wwwãæ±äº¬ãjp> would still be successfully decoded to C<www.xn--1lqs71d.jp>
If the host name provided is not an international domain name (a.k.a. IDN), it is simply returned as is. Thus, if C<www.example.org> is provided, it would return C<www.example.org>
If an error occurred, it sets an error object and returns L<perlfunc/undef>. The error can then be retrieved using L<Module::Generic/error> inherited by this module.
lib/Cookie/Domain.pm view on Meta::CPAN
=head2 encode
This does the reverse operation from L</decode>.
It takes a domain name, or rather called a host name, already decoded, and with its so called ASCII Compatible Encoding a.k.a. C<ACE> prefix C<xn--> such as C<xn--wmq0m700b.jp> and returns its encoded version in perl internal utf8 encoding. Using the...
Just like in L</decode>, if a non-international domain name is provided, it is returned as is. Thus, if C<www.example.org> is provided, it would return C<www.example.org>
Note that this returns the name in perl's internal utf8 encoding, so if you need to save it to an utf8 file or print it out as utf8 string, you still need to encode it in utf8 before. For example:
view all matches for this distribution
view release on metacpan or search on metacpan
0.02 Thu Jul 12 11:41:29 MSK 2012
- add debian infrastructure
0.03 Fri Jul 13 22:14:06 MSK 2012
- user could throw exceptions in decoded utf8
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Couch/DB.pm view on Meta::CPAN
# Returns the JSON structure which is part of the response by the CouchDB
# server. Usually, this is the body of the response. In multipart
# responses, it is the first part.
sub _extractAnswer($) { panic "must be extended" }
# The the decoded named extension from the multipart message
sub _attachment($$) { panic "must be extended" }
# Extract the decoded body of the message
sub _messageContent($) { panic "must be extended" }
1;
#-------------
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Couchbase/Bucket.pm view on Meta::CPAN
# Query options
{ _host => "localhost:8093" }
);
foreach my $row (@{$rv->rows}) {
# do something with decoded JSON
}
The C<queryargs> parameter can either be a hashref of named placeholders
(omiting of course, the leading C<$> which is handled internally), or it can
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Courier/Filter/Module/Parts.pm view on Meta::CPAN
=item B<views>
An arrayref containing the global default set of I<views> the filter module
should apply to message parts when matching the configured signatures against
them. A view is the way how a MIME part's (MIME-decoded) data is interpreted.
Defaults to B<['raw']>.
The following views are supported:
=over
=item B<raw>
The MIME part is MIME-decoded but not otherwise transformed. The raw MIME part
is then matched against the configured signatures.
=item B<zip>
If the MIME part has a file name ending in C<.zip>, it is considered a ZIP
lib/Courier/Filter/Module/Parts.pm view on Meta::CPAN
The file name of the message part.
=item B<size>
The exact size (in bytes) of the decoded message part.
=item B<digest_md5>
The MD5 digest of the decoded message part (32 hex digits, as printed by
`md5sum`).
=item B<encrypted>
A boolean value denoting whether the message part is encrypted and its contents
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Courriel.pm view on Meta::CPAN
If you pass a reference, then the scalar underlying the reference I<will> be
modified, so don't pass in something you don't want modified.
By default, Courriel expects that content passed in text is binary data. This
means that it has not been decoded into utf-8 with C<Encode::decode()> or by
using a C<:encoding(UTF-8)> IO layer.
In practice, this doesn't matter for most emails, since they either contain
only ASCII data or they actually do contain binary (non-character) data.
However, if an email is using the 8bit Content-Transfer-Encoding, then this
does matter.
If the email has already been decoded, you must set C<is_character> to a true
value.
It's safest to simply pass binary data to Courriel and let it handle decoding
internally.
view all matches for this distribution
view release on metacpan or search on metacpan
codeset range. Neither of these flags conflict with each other, although
some combinations make less sense than others.
Care has been taken to make all flags symmetrical with respect to
C<encode> and C<decode>, that is, texts encoded with any combination of
these flag values will be correctly decoded when the same flags are used
- in general, if you use different flag settings while encoding vs. when
decoding you likely have a bug somewhere.
Below comes a verbose discussion of these flags. Note that a "codeset" is
simply an abstract set of character-codepoint pairs, while an encoding
=item C<utf8> flag disabled
When C<utf8> is disabled (the default), then C<encode>/C<decode> generate
and expect Unicode strings, that is, characters with high ordinal Unicode
values (> 255) will be encoded as such characters, and likewise such
characters are decoded as-is, no changes to them will be done, except
"(re-)interpreting" them as Unicode codepoints or Unicode characters,
respectively (to Perl, these are the same thing in strings unless you do
funny/weird/dumb stuff).
This is useful when you want to do the encoding yourself (e.g. when you
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CracTools/Utils.pm view on Meta::CPAN
# Decode base 64 error list
sub decodePosListInBase64 {
my $encoded_str = shift;
my @encoded_list = split "", $encoded_str;
my (@index,@decoded_list);
#Looking for index of each char
foreach my $j (@encoded_list) {
my @ind = grep { $Base64_ENCODING[$_] eq $j } 0 .. $#Base64_ENCODING;
push(@index,$ind[0]);
lib/CracTools/Utils.pm view on Meta::CPAN
# Convert into list position
for (my $e = 0; $e < (0+@encoded_list);$e++) {
for(my $i=0; $i<$Base64_BITNESS; $i++) {
if ($index[$e] & (1 << $i)) {
my $pos = (int($i+$Base64_BITNESS*$e));
push(@decoded_list,$pos);
}
}
}
return @decoded_list;
}
lib/CracTools/Utils.pm view on Meta::CPAN
Encode a (0-based) list of increasing position to a string using Base64
encoding scheme : ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
my $encoded_list = CracTools::Utils::encodePosListToBase64(1,3,5,8,12,32);
my @decoded_list = CracTools::Utils::decodePosListInBase64($encoded_list);
=head2 decodePosListInBase64
Decode position list encoded by encodePosListToBase64.
view all matches for this distribution
view release on metacpan or search on metacpan
src/encoding.c view on Meta::CPAN
}
/*
* Decode Base64 chars into bytes. The '*dst_len' value must initially
* contain the length of the output buffer '*dst'; when the decoding
* ends, the actual number of decoded bytes is written back in
* '*dst_len'.
*
* Decoding stops when a non-Base64 character is encountered, or when
* the output buffer capacity is exceeded. If an error occurred (output
* buffer is too small, invalid last characters leading to unprocessed
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Bear/AEAD.pm view on Meta::CPAN
my $tag = $aead->get_tag;
$aead->reset($iv);
$aead->aad_inject($aad);
$aead->flip;
my $decoded = $aead->run($ciphertext, 0);
=head1 DESCRIPTION
This is a base-class for Authenticated encryption with additional data, such as L<GCM|Crypt::Bear::GCM>, L<CCM|Crypt::Bear::CCM> and L<EAX|Crypt::Bear::EAX>. These are typtically used with a block cipher such as C<AES>.
view all matches for this distribution
view release on metacpan or search on metacpan
2.32 Fri Dec 14 14:20:17 EST 2012
- Fix "Taint checks are turned on and your key is tainted" error when autogenerating salt and IV.
2.31 Tue Oct 30 07:03:40 EDT 2012
- Fixes to regular expressions to avoid rare failures to
correctly strip padding in decoded messages.
- Add padding type = "none".
- Both fixes contributed by Bas van Sisseren.
2.29 Tue Apr 22 10:22:37 EDT 2008
- Fixed errors that occurred when encrypting/decrypting utf8 strings
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/CipherSaber.pm view on Meta::CPAN
use Crypt::CipherSaber;
my $cs = Crypt::CipherSaber->new('my sad secret key');
my $coded = $cs->encrypt('Here is a secret message for you');
my $decoded = $cs->decrypt($coded);
# encrypt from and to a file
open my $in, 'secretletter.txt' or die "Can't open infile: $!";
open my $out, '>', 'secretletter.cs1' or die "Can't open outfile: $!";
binmode $in;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/FNA.pm view on Meta::CPAN
$krypto->decrypt_file($name_encrypted_file, $name_decrypted_file)
The input file is read and decoded through the curve (F), the output file.
=head2 encrypt_scalar
The method encrypt_scalar digit strings: the result of encryption is a vector containing the cryptogram.
The syntax is:
view all matches for this distribution
view release on metacpan or search on metacpan
t/004_custom_base64.t view on Meta::CPAN
'der2pem() (encode())',
);
is(
Crypt::Format::pem2der($faux_pem),
'decoded',
'pem2der() (decode())',
);
}
#----------------------------------------------------------------------
package BadBase64;
sub encode { "encoded\n" }
sub decode { 'decoded' }
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/HSXKPasswd/RNG/RandomDotOrg.pm view on Meta::CPAN
if($response->is_error()){
_error('failed to retrieve numbers from Random.Org web service with error code '.$response->code().' ('.$response->message.')');
}
# parse the result
my $raw_numbers = $response->decoded_content();
my @ans = ();
RESPONSE_LINE:
foreach my $line (split /\n/sx, $raw_numbers){
# validate the line
unless($line && $line =~ m/^\d+$/sx){
view all matches for this distribution