Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    String::CRC::Cksum 0.91

    Download button

    No screenshots available
    Downloads: 1,192  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Andrew Hamm | More programs
    Perl Artistic License / FREE
    February 4th, 2009, 14:24 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    String::CRC::Cksum description

    Perl extension for calculating checksums in a manner compatible with the POSIX cksum program.

    String::CRC::Cksum is a Perl extension for calculating checksums in a manner compatible with the POSIX cksum program.

    SYNOPSIS

    OO style: use String::CRC::Cksum;

     $cksum = String::CRC::Cksum->new;
     $cksum1 = $cksum->new; # clone (clone is reset)

     $cksum->add("string1");
     $cksum->add("string2");
     $cksum->add("string3", "string4", "string5", ...);
     ...
     ($cksum, $size) = $cksum->peek;
     $cksum->add("string6", ...);
     ...
     ($cksum, $size) = $cksum->result;

     $cksum1->addfile(*file1); # note: adding many files
     $cksum1->addfile(*file2); # is probably a silly thing
     $cksum1->addfile(*file3); # to do, but you *could*...
     ...

    Functional style: use String::CRC::Cksum qw(cksum);

     $cksum = cksum("string1", "string2", ...);

     ($cksum, $size) = cksum("string1", "string2", ...);

     $cksum = cksum(*FILE);

     ($cksum, $size) = cksum(*FILE);


    The String::CRC::Cksum module calculates a 32 bit CRC, generating the same CRC value as the POSIX cksum program. If called in a list context, returns the length of the data object as well, which is useful for fully emulating the cksum program. The returned checksum will always be a non-negative integral number in the range 0..2^32-1.

    Despite its name, this module is able to compute the checksum of files as well as of strings. Just pass in a reference to a filehandle, or a reference to any object that can respond to a read() call and eventually return 0 at "end of file".

    Beware: consider proper use of binmode() if you are on a non-UNIX platform or processing files derived from other platforms.

    The object oriented interface can be used to progressively add data into the checksum before yielding the result.

    The functional interface is a convenient way to get a checksum of a single data item.

    None of the routines make local copies of passed-in strings so you can safely Cksum large strings safe in the knowledge that there won't be any memory issues.

    Passing in multiple files is acceptable, but perhaps of questionable value. However I don't want to hamper your creativity...


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    calculate checksums | Perl module | cksum | CRC | checksum

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM