def cipher(
        message: str,
        key: list[int],
        /,
):
    """
    Encrypts message using row transposition cipher using supplied key.
    """
    rows = len(message)//len(key) + (1 if len(message) % len(key) else 0)
    output = []
    for row in range(rows):
        output.append(['']*len(key))
        for i, key_value in enumerate(key):
            output[row][i] = message[len(key)*row + key_value] if len(key)*row + key_value < len(message) else '\ufffd'
        output[row] = ''.join(output[row])
    return ''.join(output)