The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::FCP::Util - utility functions.

SYNOPSIS

 use Net::FCP::Util;

DESCRIPTION

touc $string

Returns the uppercased version of the given identifier. Used internally to map from e.g. URIError/KeyCollision to the form used in this module, i.e. uri_error/key_collision etc.

tolc $string

Returns the lowercased version of the given identifier. See touc.

xeh $number

The opposite of hex, i.e. returns the the number as hex string. Mainly useful due to it's prototype of $.

log2 $num[, $minlog]

Calculate the (integer) log2 of a number, rounded up. If $minlog is given it will be the minimum value returned.

encode_mpi $num

Encode the given number as a multiple-precision number (2 byte bitlength + bytes)

decode_base64 $string

Decode freenet's perverted version of base64.

encode_base64 $data

Encode into freenet's perverted version of base64.

generate_chk_hash $metadata, $data

Generate and return they hash portion (the part after the comma, the crypto key) that would be used in the CHK (as binary). This can be used to verify contents of a CHK, since this key is a hash over the data.

(This function assumes a 128 bit key, which seems standard in freenet).

extract_chk_hash $uri

Extract the hash portion (the part after the comma, the crypto key) of a CHK (in binary). Useful to compare against the output of generate_chk_key.

SEE ALSO

Net::FCP.

BUGS

Not heavily tested.

AUTHOR

 Marc Lehmann <schmorp@schmorp.de>
 http://home.schmorp.de/