A collection of optimized, low-level algorithmic utilities written in C. This repository features three separate programs demonstrating string manipulation, dynamic memory allocation, complex token tracking, bitwise manipulation, and runtime polymorphisim using arrays of function pointers.
The project is split into three main standalone utilities:
- Custom Key Shifter / Cipher (
problema1.c) - Text Autofill & Word Template Engine (
problema2.c) - Randomized Multi-Strategy String Encoder (
problema3.c)
An alphabetic string encryption tool inspired by classical ciphers. It processes an input text using a variable key sequence to displace character values.
- Input Validation: Restricts execution strictly to English alphabetical characters, discarding invalid combinations up-front.
- Dynamic Key Adjustment: Truncates or extends the cipher key cyclically to precisely match the target string length.
- Cross-Case Wrapping Shifter: Shifts character codes with a unique boundary wrap that transitions from lowercase
'z'directly to uppercase'A', and uppercase'Z'to lowercase'a'.
A template engine utility designed to replace defined metadata key placeholders inside unformatted texts while completely preserving structural positioning, punctuation, and spacing.
- Key-Value Dictionary Structure: Manages placeholder tags using custom heap-allocated
pairstruct arrays. - Punctuation & Layout Preservation: Pairs text tokenization (
strtok) with a parallel tracking buffer (copie) to append non-alphanumeric separators accurately to the modified output stream. - Dynamic Buffer Scaling: Progressively grows and shrinks the destination string via runtime
reallocboundaries to eliminate memory waste.
A randomized text generation and obfuscation framework that maps character structures through multiple algorithmic encoding pathways using dynamic function dispatch arrays.
- Pseudo-Random Deterministic Setup: Generates random text block strings using customizable bounds and a explicit seed value (
srand). - Function Pointer Dispatching: Dispatches individual characters to processing routines dynamically at runtime via an array of function pointers (
char* (*codificare[])(char)). - Encoding Strategies Included:
- Strategy 1 (Frequency Mapping): Tracks character history counts globally using
staticarrays, outputting the symbol alongside its cumulative usage tally. - Strategy 2 (Bit Manipulation): Inverts target bit coordinates via XOR masking, aggregates total binary set bits (1-bits), applies manual mask bit overrides (
| 32,& ~1), and packs both results into a composite output structure. - Strategy 3 (Case Transposition): Detects and transposes lowercase elements to their uppercase ASCII equivalents.
- Strategy 1 (Frequency Mapping): Tracks character history counts globally using
- Advanced Memory Optimization: Clean implementations of dynamic data resizing (
malloc,realloc,free) to guarantee zero memory leaks at termination. - Functional Programming in C: Executing decoupled behaviors via function pointer arrays.
- Bitwise Arithmetic: Deep utilization of bit shifts (
<<), bitwise XOR (^), bitwise OR (|), and bitwise AND (&) patterns for low-level value morphing.