import struct
import base64


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

    REST uses base64 encoded 32-bit big endian integers, while protos use just `int32`.
    """
    return struct.unpack(">I", base64.b64decode(crc32c.encode("utf-8")))[0]