mojic 2.1.0 โ†’ 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,17 +1,18 @@
1
- # Mojic v1.2.5
1
+ # Mojic v2.1.2
2
2
 
3
- > **Operation Polymorphic Chaos: Obfuscate C source code into a randomized, password-seeded stream of emojis.**
3
+ > **Operation Ironclad: Obfuscate C source code into a randomized, password-seeded stream of emojis.**
4
4
 
5
5
  **Mojic** (Magic + Emoji + Logic) is a sophisticated CLI tool designed to transform readable C code into an unrecognizable chaotic stream of emojis. Unlike simple substitution ciphers, Mojic uses your password to seed a cryptographically strong Pseudo-Random Number Generator (PRNG), creating a unique "Emoji Universe" and rolling cipher for every single session.
6
6
 
7
7
  ## Key Features
8
8
 
9
- * ** Xoshiro256** PRNG:** Uses a high-quality 256-bit state PRNG (seeded via PBKDF2-SHA512) to handle shuffling and polymorphism.
10
- * ** Polymorphic Keywords:** Common C keywords (`int`, `void`, `return`) are mapped to emojis that *change* every time they appear based on the PRNG state. Frequency analysis is impossible.
11
- * ** Base-1024 Compression:** Non-keyword code is compressed using a custom Base-1024 scheme (5 bytes โ†’ 4 emojis), keeping file size manageable.
12
- * ** Integrity Sealed:** Every file ends with an HMAC-SHA256 signature. Any tampering with the emoji stream results in an immediate `FILE_TAMPERED` error.
13
- * ** Moon Header Protocol:** Metadata (Salt + Auth Check) is encoded using a specific alphabet of Moon and Clock phases (`๐ŸŒ‘๐ŸŒ’๐Ÿ•`), allowing instant password verification before decryption starts.
14
- * ** Stream Architecture:** Built on Node.js `Transform` streams to handle large files efficiently with minimal memory footprint.
9
+ * **AES-256-CTR PRNG:** Uses a military-grade cryptographically secure pseudorandom number generator (seeded via Scrypt) to handle shuffling and polymorphism.
10
+ * **Polymorphic Keywords:** Common C keywords (`int`, `void`, `return`) are mapped to emojis that *change* every time they appear based on the PRNG state. Frequency analysis is impossible.
11
+ * **XOR Whitening:** Before encoding, all raw data (whitespace, variable names) is XORed with the AES keystream. This ensures that repeating patternsโ€”like 4 spaces of indentationโ€”never produce the same emoji sequence twice.
12
+ * **Base-1024 Compression:** Non-keyword code is compressed using a custom Base-1024 scheme (5 bytes โ†’ 4 emojis), keeping file size manageable.
13
+ * **Integrity Sealed:** Every file ends with an HMAC-SHA256 signature. Any tampering with the emoji stream results in an immediate `FILE_TAMPERED` error.
14
+ * **Moon Header Protocol:** Metadata (Salt + Auth Check) is encoded using a specific alphabet of Moon and Clock phases (`๐ŸŒ‘๐ŸŒ’๐Ÿ•`), allowing instant password verification before decryption starts.
15
+ * **Stream Architecture:** Built on Node.js `Transform` streams to handle large files efficiently with minimal memory footprint.
15
16
 
16
17
  ## Installation
17
18
 
@@ -69,26 +70,30 @@ mojic srt --re secret.mojic
69
70
 
70
71
  ## Under the Hood (Algorithm)
71
72
 
72
- Mojic v1.1.0 implements a custom crypto-system dubbed **"Operation Polymorphic Chaos"**.
73
+ Mojic v2.1.0 implements a custom crypto-system dubbed **"Operation Ironclad"**.
73
74
 
74
75
  1. **Derivation Phase:**
75
- * **Input:** User Password + 16-byte Random Salt.
76
- * **KDF:** `PBKDF2-SHA512` (100,000 iterations).
77
- * **Output:** 64 bytes (32 bytes for PRNG Seed, 32 bytes for HMAC Auth Key).
76
+ * **Input:** User Password + 32-byte Random Salt.
77
+ * **KDF:** `Scrypt` (N=16384, r=8, p=1).
78
+ * **Output:** 80 bytes (32 bytes AES Key, 16 bytes AES IV, 32 bytes HMAC Auth Key).
78
79
 
79
80
  2. **The Emoji Universe:**
80
- * The engine generates a universe of ~1,100 valid emojis (Emoticons, Transport, Symbols).
81
- * This universe is **shuffled** using the `Xoshiro256**` PRNG initialized with the derived seed.
81
+ * The engine generates a universe of ~1,100 valid unicode characters (Emoticons, Transport, Symbols).
82
+ * This universe is **shuffled** using the `AES-256-CTR` CSPRNG initialized with the derived key.
82
83
 
83
84
  3. **Polymorphic Encryption:**
84
85
  * **C Keywords:** The engine detects C keywords (e.g., `while`). It assigns them a "Base Emoji" from the shuffled universe.
85
86
  * **The Twist:** It doesn't just print the Base Emoji. It calculates a random offset using the PRNG to pick a *different* emoji that maps back to the keyword. This means `int` might look like `๐Ÿš€` on line 1 and `๐ŸŒฎ` on line 5.
86
87
 
87
- 4. **Base-1024 Encoding:**
88
- * Non-keyword data is buffered into 5-byte chunks.
89
- * These chunks are treated as a single large integer and converted into 4 base-1024 digits (mapped to emojis), effectively compressing the stream density.
88
+ 4. **XOR Whitening:**
89
+ * Before encoding non-keyword data (variable names, strings, whitespace), the engine generates a random mask from the AES stream.
90
+ * The raw data is **XORed** with this mask. This hides repetitive patterns (like indentation or common variable names) effectively turning them into white noise before they are converted to emojis.
90
91
 
91
- 5. **The Header:**
92
+ 5. **Base-1024 Encoding:**
93
+ * The whitened data is buffered into 5-byte chunks.
94
+ * These chunks are treated as a single large integer and converted into 4 base-1024 digits (mapped to emojis).
95
+
96
+ 6. **The Header:**
92
97
  * The Salt and a 4-byte Auth Check are written to the file header using the **Moon/Clock Alphabet** (`๐ŸŒ‘๐ŸŒ’๐ŸŒ“๐ŸŒ”...`).
93
98
  * **Benefit:** This allows `mojic` to tell you "Incorrect Password" instantly, rather than churning out garbage data first.
94
99
 
package/bin/mojic.js CHANGED
@@ -9,10 +9,12 @@ import { Transform } from 'stream';
9
9
  import { StringDecoder } from 'string_decoder';
10
10
  import { CipherEngine } from '../lib/CipherEngine.js';
11
11
 
12
+ const VERSION = '2.1.2';
13
+
12
14
  program
13
15
  .name('mojic')
14
16
  .description('Obfuscate C source code into emojis')
15
- .version('2.1.0')
17
+ .version(VERSION)
16
18
  .addHelpCommand('help [command]', 'Display help for command')
17
19
  .showHelpAfterError();
18
20
 
@@ -119,7 +121,7 @@ program
119
121
  throw new Error(`'${targetPath}' is a directory. Use -r to process recursively.`);
120
122
  }
121
123
 
122
- console.log(chalk.blue('Initiating Mojic Encryption v1.2...'));
124
+ console.log(chalk.blue(`Initiating Mojic Encryption v${VERSION}...`));
123
125
  if (options.flat) console.log(chalk.yellow(' -> Structural Flattening Enabled'));
124
126
 
125
127
  const password = await promptPassword('Create password for file(s):');
@@ -3,7 +3,7 @@ import { Transform } from 'stream';
3
3
  import { StringDecoder } from 'string_decoder';
4
4
 
5
5
  /**
6
- * MOJIC v2.1.0 CIPHER ENGINE
6
+ * MOJIC v2.1.2 CIPHER ENGINE
7
7
  * "Operation Ironclad"
8
8
  * * Security Upgrades:
9
9
  * - KDF: Upgraded from PBKDF2 to Scrypt (Memory-Hard, GPU-Resistant)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mojic",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Obfuscate C source code into encrypted, password-seeded emoji streams.",
5
5
  "main": "bin/mojic.js",
6
6
  "bin": {