Skip to content

Generate AI-driven or local random text, save it to file, and verify integrity with SHA-256 hashing in an easy-to-use pipeline.

License

Notifications You must be signed in to change notification settings

3ConstArt3/CodeGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

CodeGenerator

CodeGenerator is a flexible, AI-augmented (or local) text/payload generator pipeline in Python. It allows you to generate (or fetch) random or AI-driven text, optionally save outputs to file, and verify integrity via SHA-256 hashing - all in an easy-to-use, configurable workflow. Whether you want to create pooled random text (e.g. placeholders, test data, lorem-style strings), harness a generative-AI API, or build reproducible pipelines that track and hash content, CodeGenerator is tailored to be simple, modular and extensible.


📂 What’s in This Repo

At its heart, CodeGenerator is a small but capable engine that takes you from "I need something generated" to "I have it stored, organized, and ready to use" in one clean flow. Everything revolves around a simple pipeline: generate, handle, store. You can choose how the text is created - whether through a built-in local generator for quick random output, or through an external AI model when you want something more expressive. Once generated, the system knows how to save your results anywhere you need: individual files, entire directories, or even custom storage destinations you might plug in later.

If you care about reproducibility or want to confirm that outputs haven’t been altered, the project includes optional SHA-256 hashing, letting you verify the integrity of any generated item. And because everything is configurable, you’re free to specify how many items should be produced, how long or structured the text should be, where it should be saved, and whether hashing should be enabled. All of these pieces work together to create a flexible toolkit - equally helpful when you’re prototyping and need quick mock data, or when you’re building larger generative-text systems, research workflows, or creative experiments.


🚀 Getting Started

You’ll need Python (version 3.x) installed. To begin:

git clone https://github.com/3ConstArt3/CodeGenerator.git
cd CodeGenerator
pip install -r requirements.txt   # if there is a requirements file

Then you can run the main driver script (for example):

python main.py

You’ll be prompted (or the config will be read) to choose generation mode (random or AI), number of items, output directory, hashing option, etc. Once set, CodeGenerator runs, creates the generated output(s), and - if enabled - writes a .sha256 file per output to record its hash.

🔧 What You Can Tweak / Explore

CodeGenerator was built to be flexible from the ground up - almost every aspect of its behavior can be tweaked, extended or replaced. Below are some illustrative examples, showing how you might configure or extend key parts of the system - and what effect those changes have.

• Generation Backend & Mode Selection

By default, a remote AI generator - for more output variations and also for integrity - is used, but in case of a connection error with the API, a custom local generator is utilized as a comfortable and easy to use, back-up plan. This whole thought process is summarized neatly, in the following section of code:

text = self.remote.generate(
  char_length = char_length,
  model = model,
  temperature = temperature
)

return text if text is not None else self.local.generate(char_length = char_length)

💡This example, shows how easily you can pivot between different generation strategies - useful for prototyping, testing, or creative output.

• Custom Generator Function

Maybe you already have your own text-generation logic (templating engine, Markov chain, database fetch, etc.). In that case, CodeGenerator can accept a custom function and integrate it into the pipeline without a problem! Just make sure, to change the default LocalTextGenerator with the name of your own class in the following line of code, in the file TextGenerator.py:

local: MyCustomTextGenerator = field(default_factory = MyCustomTextGenerator)

• Integrity Verification with SHA-256 Hashing

One of the strong features of CodeGenerator is its optional hashing mechanism - helpful when you care about reproducibility, versioning, or verifying that outputs haven’t changed. This is particularly handy in collaborative or production setups - or simply if you want confidence that your generated output remains unchanged over time.

import hashlib

# Suppose an output file "example.txt" was generated with hashing enabled:
with open("output/example.txt", "rb") as f:
    content = f.read()

digest = hashlib.sha256(content).hexdigest()
print("Computed hash:", digest)

# You can compare this hash with the recorded .sha256 file to verify integrity.

Meaning Behind Examples

These examples-snippets show, that using CodeGenerator is rarely "all or nothing." You can start with defaults (quick text generation), but as your needs evolve - for example into AI-assisted generation or content pipelines, the tool scales along with you. You don’t need to rewrite your whole workflow: you can simply plug in custom functions, toggle hashing, or reroute outputs - and still maintain a clean, reproducible and organized pipeline. The project becomes a backbone for varied use cases like testing, data generation, creative writing and more!

🎯 Why This Matters

CodeGenerator exists to save you from the endless loop of rewriting small one-off scripts every time you need a bit of mock data or a batch of generated text. Instead of juggling scattered utilities, you get a single, flexible system that handles it all - reliably, consistently and in a way you can easily customize. If you need a reproducible dataset for a demo tomorrow, it can do that. If you want to experiment with AI-driven text while still keeping local backups and verifiable hashes, it has your back.

And if you're building larger creative or technical workflows - whether for writing, automation, or content production - CodeGenerator makes for a sturdy, adaptable foundation you can grow from. It’s equal parts convenience and control: a tool that gets out of your way when you just need quick results, but stays powerful enough to scale into full pipelines.

💡 Use Cases & Inspiration

CodeGenerator fits naturally into all sorts of projects. You might use it to generate placeholder text for software prototypes, produce structured mock data for testing, or run batches of AI-generated content that you want to store and verify. It’s also a great companion for creative writing experiments - things like generating prompt variations, artistic seeds, or large collections of text patterns.

Beyond that, it can slide neatly into data-oriented workflows: logging pipelines, dataset creation, content automation, or anything that follows a “generate → store → verify” pattern. If your work involves producing text in any systematic way, chances are CodeGenerator can make that process cleaner, more reliable and much more enjoyable!

📄 License

This project is released under the Apache-2.0 License.
For details, consult the LICENSE file in the repository.

About

Generate AI-driven or local random text, save it to file, and verify integrity with SHA-256 hashing in an easy-to-use pipeline.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages