MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/share/doc/m2crypto-0.16/demo/pgp/test.py
#!/usr/bin/python

"""PGP test program.

Copyright (c) 1999 Ng Pheng Siong. All rights reserved."""

from M2Crypto import EVP, PGP
from cStringIO import StringIO

def test1():
    pkr = PGP.load_pubring('pubring.pgp')
    daft = pkr['daft']
    daft_pkt = daft._pubkey_pkt.pack()
    s1 = EVP.MessageDigest('sha1')
    s1.update(daft_pkt)
    print `s1.final()`

    buf = StringIO(daft_pkt)
    ps = PGP.packet_stream(buf)
    dift_pkt = ps.read()
    s2 = EVP.MessageDigest('sha1')
    s2.update(dift_pkt.pack())
    print `s2.final()`

if __name__ == '__main__':
    test1()