Benjamin Trott > Crypt-OpenPGP-1.06 > Crypt::OpenPGP::MDC



Annotate this POD


New  11
Open  6
Stalled  1
View/Report Bugs
Source   Latest Release: Crypt-OpenPGP-1.12


Crypt::OpenPGP::MDC - MDC (modification detection code) packet


    use Crypt::OpenPGP::MDC;

    my $mdc = Crypt::OpenPGP::MDC->new( Data => 'foobar' );
    my $digest = $mdc->digest;
    my $serialized = $mdc->save;


Crypt::OpenPGP::MDC is a PGP MDC (modification detection code) packet. Such a packet is used alongside Encrypted-MDC data packets so that modifications to the ciphertext can be detected. The MDC packet contains a SHA-1 digest of the plaintext for comparison with the decrypted plaintext.

You generally will never need to construct a Crypt::OpenPGP::MDC packet yourself; usage is by the Crypt::OpenPGP::Ciphertext object.


Crypt::OpenPGP::MDC->new( [ Data => $data ] )

Creates a new MDC packet object and returns that object. If you do not supply any data $data, the object is created empty; this is used, for example, in parse (below), to create an empty packet which is then filled from the data in the buffer.

If you wish to initialize a non-empty object, supply new with the Data parameter along with a value $data. $data should contain the plaintext prefix (length = cipher blocksize + 2), the actual plaintext, and two octets corresponding to the hex digits 0xd3 and 0x14.


Returns the text of the MDC packet; this is the digest of the data passed to new (above) as $data, for example.


Given $buffer, a Crypt::OpenPGP::Buffer object holding (or with offset pointing to) an MDC packet, returns a new <Crypt::OpenPGP::MDC> object, initialized with the MDC data in the buffer.


Returns the MDC digest data (eg. the string passed as $data to new, above).


Please see the Crypt::OpenPGP manpage for author, copyright, and license information.

syntax highlighting: