import struct


def pack128(int_val):
    """ pack a 128-bit integer in big-endian format """
    max_int = 2 ** (128) - 1
    max_word_size = 2 ** 32 - 1
    
    if int_val <= max_word_size:
        return struct.pack('>L', int_val)
    
    words = []
    for i in range(4):
        word = int_val & max_word_size
        words.append(int(word))
        int_val >>= 32
    words.reverse()
    return struct.pack('>4I', *words)