Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
1662714
Rename alphanumeric-generator.php to v.0.1/alphanumeric-generator.php
Mar 13, 2017
76d15ba
Rename examplo.php to v.0.1/examplo.php
Mar 13, 2017
f99b696
Rename alphanumeric-generator.php to v.0.1/alphanumeric-generator.php
Mar 13, 2017
e71a795
Create UniqueKey.php
Mar 13, 2017
481bab2
Create Example.php
Mar 13, 2017
d2a210d
Create unique_key_generator.php
Mar 13, 2017
1def44d
Merge pull request #1 from LukasStribrny/patch-1
Mar 13, 2017
dcb206a
Merge remote-tracking branch 'refs/remotes/origin/master' into patch-1
PatrickImProVision Mar 13, 2017
2a26507
Update Example.php
Mar 14, 2017
41a10c1
Update UniqueKey.php
Mar 14, 2017
29c8b46
Create Example_Generate_ID.php
Mar 14, 2017
0b7e452
Merge pull request #2 from LukasStribrny/patch-1
Mar 14, 2017
f2ce355
Update UniqueKey.php
Mar 15, 2017
916c710
Update UniqueKey.php
Mar 15, 2017
75cc227
Rename readme.md to v.0.1/readme.md
Mar 15, 2017
0662090
Delete .gitignore
Mar 15, 2017
ef773f4
Final Update UniqueKey.php
Mar 18, 2017
6801f21
Rename Example.php to Example_Generate_String.php
Mar 18, 2017
bbbdf47
Clean Code UniqueKey.php
Mar 18, 2017
dfe0f85
Fix Update CANG.php
Mar 19, 2017
bd2d14f
Update Example_Generate_ID.php
Mar 19, 2017
e284a80
Update Example_Generate_String.php
Mar 19, 2017
4315e0f
Final Update CANG.php -> Please read the details
Mar 19, 2017
f18b0f5
Create Example_Generate_Random.php
Mar 19, 2017
455638f
Finished CANG.php
Mar 27, 2017
24f0c20
Update CANG.php
May 10, 2017
90a187b
Create README.md
Nov 12, 2017
704f64b
Create Example_Generate_Random_Microsoft_SN.php
Nov 16, 2017
f0c1f40
Add files via upload
Nov 16, 2017
20bca1f
Delete product-key-coa-windows-5922174a3df78cf5facd7f7c.png
Nov 16, 2017
152baad
Add files via upload
Nov 16, 2017
bec8146
Rename Example_Generate_Random_Microsoft_SN.php to Example_Microsoft_…
Nov 16, 2017
a443fdd
Delete Example_Microsoft_SN_Generate_Random.php
Nov 16, 2017
899f19d
Create Example_Microsoft_SN_Generate_Random.php
Nov 16, 2017
58e351f
Update CANG.php
Nov 16, 2017
9ccb7ea
Update CANG to check if function_exists('bcpow')
Dec 2, 2017
e2fb722
Update Example_Microsoft_SN_Generate_Random.php
Dec 2, 2017
807e7dd
Create Example_Microsoft_SN_Generate_ID.php
Dec 2, 2017
8ad34d0
Create Example_Generate_ID_JSON.php
Dec 2, 2017
c6435f5
Create Example_Generate_Random_JSON.php
Dec 2, 2017
99e21a1
Create Example_Generate_String_JSON.php
Dec 2, 2017
5dd5039
Create Example_Microsoft_SN_Generate_ID_JSON.php
Dec 2, 2017
9716714
Create Example_Microsoft_SN_Generate_Random_JSON.php
Dec 2, 2017
baa759c
Rename README.md to v.0.3/README.md
Dec 2, 2017
40d5c31
Update Example_Generate_ID.php
Dec 6, 2017
55db506
Update CANG.php -> replace protected by public
Dec 6, 2017
bd6b050
Update CANG.php
Dec 8, 2017
410492e
Rename v.0.3/CANG.php to v.0.3/Base_CANG_Generators/CANG.php
Dec 8, 2017
d87b3aa
Update and rename v.0.3/Example_Generate_ID.php to v.0.3/Base_Example…
Dec 8, 2017
d58f02f
Update and rename v.0.3/Example_Generate_ID_JSON.php to v.0.3/Base_Ex…
Dec 8, 2017
73fc930
Update and rename v.0.3/Example_Generate_Random.php to v.0.3/Base_Exa…
Dec 8, 2017
637665c
Update and rename v.0.3/Example_Generate_Random_JSON.php to v.0.3/Bas…
Dec 8, 2017
f48478b
Update and rename v.0.3/Example_Generate_String.php to v.0.3/Base_Exa…
Dec 8, 2017
b35a15e
Update and rename v.0.3/Example_Generate_String_JSON.php to v.0.3/Bas…
Dec 8, 2017
77cbb96
Update and rename v.0.3/Example_Microsoft_SN_Generate_ID.php to v.0.3…
Dec 8, 2017
91d8498
Update and rename v.0.3/Example_Microsoft_SN_Generate_ID_JSON.php to …
Dec 8, 2017
978bde7
Update and rename v.0.3/Example_Microsoft_SN_Generate_Random_JSON.php…
Dec 8, 2017
8e436ff
Update and rename v.0.3/Example_Microsoft_SN_Generate_Random.php to v…
Dec 8, 2017
5a9c79d
Update Example_Microsoft_SN_Generate_Random_JSON.php
Dec 8, 2017
9a472c1
Create MS_G.php
Dec 8, 2017
5ec42ac
Update MS_G.php
Jan 3, 2018
227e17d
A New Version of Universal and Complex Key Generator
PatrickImProVision Dec 5, 2025
fa13bf2
Another version to Collection
PatrickImProVision Dec 5, 2025
b47bca8
Collection of Universal Generators
PatrickImProVision Dec 5, 2025
df2a482
Just a Little Update of Renaming
PatrickImProVision Dec 5, 2025
7f33976
Update Before Joining The Foundation CANG To Master Up
PatrickImProVision Jan 10, 2026
a4756c8
Add header for CANG details in README
PatrickImProVision Jan 10, 2026
31c0387
Update README And Some Structure - Almost Working Order.
PatrickImProVision Jan 10, 2026
6db6294
Merge branch 'master' of https://github.com/PatrickImProVision/Comple…
PatrickImProVision Jan 10, 2026
28ceb90
Update By Class CANG_LanguageSelect And Append All Files To Continue …
PatrickImProVision Jan 11, 2026
27dc792
Update: Removed Examples Which Will Be Moved To Different Area.
PatrickImProVision Jan 11, 2026
4aa4015
Update: README.md, Base_CANG_Display.php
PatrickImProVision Jan 11, 2026
5d7f7cd
Update: README.md
PatrickImProVision Jan 11, 2026
37b99cd
Update: Base_CANG_Display.php, And Folder Renamed To Base_CANG_NoMySQ…
PatrickImProVision Jan 11, 2026
d65b6a3
Update Development
PatrickImProVision Feb 17, 2026
f051e86
Add Support Of Validation In CANG_DataBase
PatrickImProVision Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

12 changes: 12 additions & 0 deletions Complex_Alpha-Numeric_Generator.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
"editor.formatOnPaste": true
}
}
Binary file added Example_Microsoft_SN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
206 changes: 206 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
Below is a polished, reference‑quality **README.md** you can drop directly into a GitHub repository.
It’s structured, logical, developer‑friendly, and explains the full CANG language‑selection system with clarity and purpose.

---

# **CANG — Configurable Alphanumeric Generator**

CANG is a lightweight, extensible system for generating strings based on predefined *language profiles*.
Each profile defines a **character set**, a **logical type**, and a **semantic description**, allowing developers to produce output strings that match specific formatting, security, or compatibility requirements.

CANG is ideal for:

- Token generation
- File‑ID or resource‑ID creation
- URL‑safe identifiers
- Password or key generation
- Systems requiring predictable, rule‑driven output formats

---

## 🔧 **Core Concept**

CANG operates on a simple principle:

> **Choose a Language → Load Its Character Set → Generate a Compatible Output String**

Each *Language* is defined by:

- **Language Name** — Human‑readable identifier
- **Language Type** — Regex‑style character class
- **Language Description** — Semantic explanation of intended use

---

# 📚 **Language Reference Table**

| ID | Language Name | Language Type | Description |
|----|---------------|---------------|-------------|
| 1 | `Alphabet_Upper` | `[A-Z]` | Alphabetical → Simple: Capital letters |
| 2 | `Alphabet_Lower` | `[a-z]` | Alphabetical → Simple: Small letters |
| 3 | `Alphabet_Mix` | `[A-Z,a-z]` | Alphabetical → Mix: Capital and Small letters |
| 4 | `Numeric` | `[0-9]` | Numerical → Simple |
| 5 | `Alphabet_Upper_Num` | `[A-Z,0-9]` | Alphabetical + Numerical → Simple: Capital letters (Microsoft/Megaupload‑style) |
| 6 | `Alphabet_Lower_Num` | `[a-z,0-9]` | Alphabetical + Numerical → Simple: Small letters |
| 7 | `Alphabet_Mix_Num` | `[A-Z,a-z,0-9]` | Alphabetical + Numerical → Mix: Capital and Small letters |
| 8 | `Alphabet_Mix_Num_SpecialShort` | `[A-Z,a-z,0-9,-_]` | Mix + Short Special chars (YouTube‑style) |
| 9 | `Alphabet_Mix_Num_SpecialFull` | `[A-Z,a-z,0-9,-_]` | Mix + Full Special chars (Safe Password) |

---

# 🧠 **Language Selector Logic**

CANG uses a simple numeric selector to load the correct language profile.

### **Example Selector Map**

```php
$CANG_Language = [
1 => 'Alphabet_Upper',
2 => 'Alphabet_Lower',
3 => 'Alphabet_Mix',
4 => 'Numeric',
5 => 'Alphabet_Upper_Num',
6 => 'Alphabet_Lower_Num',
7 => 'Alphabet_Mix_Num',
8 => 'Alphabet_Mix_Num_SpecialShort',
9 => 'Alphabet_Mix_Num_SpecialFull'
];
```

### **Character Set Definitions**

```php
$CANG_Type = [
1 => '[A-Z]',
2 => '[a-z]',
3 => '[A-Z,a-z]',
4 => '[0-9]',
5 => '[A-Z,0-9]',
6 => '[a-z,0-9]',
7 => '[A-Z,a-z,0-9]',
8 => '[A-Z,a-z,0-9,-_]',
9 => '[A-Z,a-z,0-9,-_]'
];
```

### **Descriptions**

```php
$CANG_Description = [
1 => 'Alphabetical -> Simple: Capital letters',
2 => 'Alphabetical -> Simple: Small letters',
3 => 'Alphabetical -> Mix: Capital and Small letters',
4 => 'Numerical -> Simple',
5 => 'Alphabetical And Numerical -> Simple: Capital letters (Microsoft/Megaupload.com)',
6 => 'Alphabetical and Numerical -> Simple: Small letters',
7 => 'Alphabetical and Numerical -> Mix: Capital and Small letters',
8 => 'Alphabetical and Numerical -> Mix: Capital/Small letters plus Short Special chars (YouTube.com)',
9 => 'Alphabetical and Numerical -> Mix: Capital/Small letters plus Full Special chars (Safe Password)'
];
```

---

# ⚙️ **How CANG Works Internally**

### **1. Select a Language ID**

```php
$languageID = 7; // Alphabet_Mix_Num
```

### **2. Load the Character Set**

```php
$charset = $CANG_Type[$languageID];
```

### **3. Convert Character Class to Actual Characters**

Example logic:

```php
function expandCharset($pattern) {
$chars = '';

if (strpos($pattern, 'A-Z') !== false) {
$chars .= implode('', range('A', 'Z'));
}
if (strpos($pattern, 'a-z') !== false) {
$chars .= implode('', range('a', 'z'));
}
if (strpos($pattern, '0-9') !== false) {
$chars .= implode('', range('0', '9'));
}
if (strpos($pattern, '-') !== false) {
$chars .= '-';
}
if (strpos($pattern, '_') !== false) {
$chars .= '_';
}

return $chars;
}
```

### **4. Generate Output String**

```php
function CANG_Generate($charset, $length = 12) {
$output = '';
$max = strlen($charset) - 1;

for ($i = 0; $i < $length; $i++) {
$output .= $charset[random_int(0, $max)];
}

return $output;
}
```

### **5. Full Example**

```php
$charset = expandCharset($CANG_Type[$languageID]);
$token = CANG_Generate($charset, 16);

echo $token; // Example: Ab9ZtQ3mP1xR7cD2
```

---

# 🚀 **Use Cases**

| Use Case | Recommended Language |
|---------|----------------------|
| Simple uppercase IDs | `Alphabet_Upper` |
| Lowercase slugs | `Alphabet_Lower` |
| Human‑friendly mixed IDs | `Alphabet_Mix` |
| Numeric codes | `Numeric` |
| Legacy file hosts (Microsoft/Megaupload‑style) | `Alphabet_Upper_Num` |
| Lowercase URL tokens | `Alphabet_Lower_Num` |
| General‑purpose tokens | `Alphabet_Mix_Num` |
| YouTube‑style video IDs | `Alphabet_Mix_Num_SpecialShort` |
| Secure passwords | `Alphabet_Mix_Num_SpecialFull` |

---

# 🧩 **Extending CANG**

CANG is intentionally modular.
To add a new language:

1. Add a new entry to **Language Name**
2. Add a matching **Language Type**
3. Add a **Description**
4. Ensure your charset parser supports the new pattern

This design keeps CANG future‑proof and easy to evolve.

---

# 🏁 **Conclusion**

CANG provides a clean, structured, and extensible way to generate strings with predictable rules.
Its language‑based architecture makes it ideal for developers who value clarity, control, and compatibility across systems.
30 changes: 0 additions & 30 deletions examplo.php

This file was deleted.

65 changes: 65 additions & 0 deletions v.0.1/SilverSoft.RunExample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
declare(strict_types=1);

require_once __DIR__ . '/alphanumeric-generator.php';

$currentNumber = 'aZ5sTp53x';

// Ensure generator function is available
if (!function_exists('anderson_makiyama_get_next_alphanumeric')) {
$msg = 'Required function anderson_makiyama_get_next_alphanumeric() is missing. Check alphanumeric-generator.php';
if (PHP_SAPI === 'cli') {
fwrite(STDERR, $msg . PHP_EOL);
} else {
echo '<p style="color:red">' . htmlspecialchars($msg, ENT_QUOTES | ENT_SUBSTITUTE) . '</p>';
}
exit(1);
}

// Get next number (safe call)
$nextNumber = anderson_makiyama_get_next_alphanumeric($currentNumber);

// Prepare output mode
$isWeb = PHP_SAPI !== 'cli';
$lineSep = $isWeb ? '<br>' : PHP_EOL;

// Print header (small HTML wrapper for browser)
if ($isWeb) {
echo '<!doctype html><meta charset="utf-8"><title>Alphanumeric generator</title>';
echo '<h2>Single step</h2>';
echo '<div>Current = ' . htmlspecialchars($currentNumber, ENT_QUOTES | ENT_SUBSTITUTE) . '</div>';
echo '<div>Next = ' . htmlspecialchars($nextNumber, ENT_QUOTES | ENT_SUBSTITUTE) . '</div>';
echo '<hr>';
} else {
echo "Current = {$currentNumber}{$lineSep}";
echo "Next = {$nextNumber}{$lineSep}";
echo str_repeat('-', 40) . $lineSep;
}

// Generate many sequential codes (buffered for performance)
$count = 5000;
$maxAllowed = 100000; // safety cap
if ($count > $maxAllowed) {
$count = $maxAllowed;
}

$code = $currentNumber;
$lines = [];
$start = microtime(true);
for ($i = 0; $i < $count; $i++) {
// If generator can throw, consider wrapping this call in try/catch
$code = anderson_makiyama_get_next_alphanumeric($code);
$lines[] = $isWeb ? htmlspecialchars($code, ENT_QUOTES | ENT_SUBSTITUTE) : $code;
}
$elapsed = microtime(true) - $start;

// Output buffered results
if ($isWeb) {
echo '<h3>A lot of sequential alphanumeric strings</h3><div style="font-family:monospace;white-space:pre-line">';
echo implode('<br>', $lines);
echo '</div>';
echo '<hr><small>Generated ' . count($lines) . ' items in ' . number_format($elapsed, 4) . 's</small>';
} else {
echo "Generated " . count($lines) . " items in " . number_format($elapsed, 4) . "s{$lineSep}";
echo implode($lineSep, $lines) . $lineSep;
}
File renamed without changes.
File renamed without changes.
Loading