コード例 #1
0
ファイル: diststream.py プロジェクト: yarang/pyhwp
def main(args):
    import sys
    import shutil

    if args['sha1']:
        head = read_record(sys.stdin, 0)
        sha1ucs16le = decode_head_to_sha1(head['payload'])
        sha1 = a2b_hex(sha1ucs16le.decode('utf-16le'))
        if not args['--raw']:
            sha1 = b2a_hex(sha1)
        sys.stdout.write(sha1)
    elif args['key']:
        head = read_record(sys.stdin, 0)
        key = decode_head_to_key(head['payload'])
        if not args['--raw']:
            key = b2a_hex(key)
        sys.stdout.write(key)
    else:
        result = decode(sys.stdin)
        shutil.copyfileobj(result, sys.stdout)
コード例 #2
0
ファイル: diststream.py プロジェクト: sececter/pyhwp
def main(args):
    import sys
    import shutil

    if args['sha1']:
        head = read_record(sys.stdin, 0)
        sha1ucs16le = decode_head_to_sha1(head['payload'])
        sha1 = a2b_hex(sha1ucs16le.decode('utf-16le'))
        if not args['--raw']:
            sha1 = b2a_hex(sha1)
        sys.stdout.write(sha1)
    elif args['key']:
        head = read_record(sys.stdin, 0)
        key = decode_head_to_key(head['payload'])
        if not args['--raw']:
            key = b2a_hex(key)
        sys.stdout.write(key)
    else:
        result = decode(sys.stdin)
        shutil.copyfileobj(result, sys.stdout)
コード例 #3
0
ファイル: test_distdoc.py プロジェクト: qingfro9/pyhwp
 def test_distdoc_decode_head_to_key(self):
     section = self.section
     expected = self.password_sha1.upper().encode('utf-16le')[:16]
     self.assertEqual(expected, decode_head_to_key(section.head()))
     self.assertEqual(expected, section.head_key())
コード例 #4
0
 def head_key(self):
     from hwp5.distdoc import decode_head_to_key
     payload = self.head()
     return decode_head_to_key(payload)
コード例 #5
0
ファイル: filestructure.py プロジェクト: hongry18/pyhwp
 def head_key(self):
     from hwp5.distdoc import decode_head_to_key
     payload = self.head()
     return decode_head_to_key(payload)