def main(): m = hashlib.sha256() while True: chunk = stdin.read(1024) if not chunk: break m.update(chunk) stdout.write(m.hexdigest().encode() + b'\n')
def main(): out = six.BytesIO() shutil.copyfileobj(stdin, out) md5 = hashlib.md5() md5.update(out.getvalue()) stdout.write(out.getvalue()) stdout.flush() stderr.write(md5.hexdigest().encode() + b'\n') stderr.flush()
def main(): args = parse_argv() remaining = args.count while remaining: chunk = stdin.read(1024) if not chunk: break output = chunk[:remaining] if remaining < len(chunk) else chunk remaining -= len(output) stdout.write(output)
def flush(buf): stdout.write(b''.join(buf + [b'\n']))
def main(): args = parse_argv() data = args.data.encode('utf8') for _ in range(args.count): stdout.write(data)