Example #1
0
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)
Example #2
0
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)
Example #3
0
 def open(self):
     from hwp5.distdoc import decode
     encodedstream = self.wrapped.open()
     return decode(encodedstream)
Example #4
0
 def open(self):
     from hwp5.distdoc import decode
     encodedstream = self.wrapped.open()
     return decode(encodedstream)