import base64
import struct


def rest_crc32c_from_proto(crc32c):
    """Convert from the gRPC/proto representation of crc32c checksums to the REST representation.

    REST uses base64 encoded 32-bit big endian integers, while protos use just `int32`.
    """
    return base64.b64encode(struct.pack(">I", crc32c)).decode("utf-8")