diff --git a/lzw.c b/lzw.c
index 161f92361b0b9d651d92968449f4124c83e1f0fd..725532f041a7773ad5cb220fe248caa449d2a3ba 100644
--- a/lzw.c
+++ b/lzw.c
@@ -40,6 +40,18 @@ void LZW_clear_table(LZW_context_T *ctx)
 	}
 }
 
+/*
+ * Creates a HBytes from an array of bytes and its length. The HBytes will keep the token pointer, to be freed later in lzw_clear_table or init_lzw_context.
+ */
+void lzw_table_insert(LZW_context_T *ctx, uint8_t *token, size_t token_len)
+{
+	HBytes * next_entry = malloc(sizeof(HBytes));
+	next_entry->token = token;
+	next_entry->len = token_len;
+	ctx->lzw_code_table[ctx->next] = next_entry;
+	ctx->next++;
+}
+
 HParser *p_lzwdata;
 LZW_context_T * context;