Published April 23, 2026 | Version v1

RSME: A Reactive Stability Mutation Encryption Algorithm for Active Defense and Lightweight Cybersecurity

Authors/Creators

Description

import math

class RSME_v21:
    def __init__(self):
        # Konfigurasi Modulus pangkat dua (2^16) untuk kecepatan maksimal
        self.M_BITMASK = 0xFFFF  # Sama dengan 65535
        self.M_VALUE = 65536     # Sama dengan 65536

    def encrypt(self, data, Y, P, S, packet_id):
        """
        RSME v2.1 Encryption Process
        Y, P, S must change every packet using a PRNG Master Seed
        """
        # Langkah 1: Linear Transformation + XOR (The Mutation Core)
        pre_mod = (data * Y - P) ^ S
        
        # Langkah 2: Bitwise Modulo (Fastest possible operation)
        ciphertext = pre_mod & self.M_BITMASK
        k = pre_mod // self.M_VALUE
        
        return {
            "ciphertext": ciphertext,
            "k": k,
            "packet_id": packet_id
        }

    def decrypt(self, pkg, Y, P, S):
        """
        RSME v2.1 Decryption Process
        Restores data using the 'k' constant instead of Modular Inverse
        """
        # Langkah 1: Restoration using 'k'
        restored = pkg["ciphertext"] + (pkg["k"] * self.M_VALUE)
        
        # Langkah 2: Reversing XOR and Linear math
        data = ((restored ^ S) + P) // Y
        return data

# --- TEST DEMO ---
rsme = RSME_v21()
original_data = 12345
# Variabel di bawah harus bermutasi via PRNG setiap transmisi
Y, P, S = 7, 100, 555 
current_id = 1

# Enkripsi
packet = rsme.encrypt(original_data, Y, P, S, current_id)
print(f"--- RSME v2.1 ENCRYPTED PACKET ---")
print(f"Data Sent: {packet}")

# Dekripsi
decrypted_result = rsme.decrypt(packet, Y, P, S)
print(f"\n--- DECRYPTION RESULT ---")
print(f"Decrypted: {decrypted_result}")
print(f"Success: {original_data == decrypted_result}")

Update Pyhton Code v2.1

Deterministic Mutation via PRNG

To ensure maximum memory efficiency on IoT/UAV hardware, RSME does not store static keys. Instead, it utilizes a Deterministic PRNG (Pseudo-Random Number Generator) mechanism:

•Synchronized State: Both the sender (UAV) and receiver (GCS) share a single Master Seed.

•On-the-fly Generation: Mutation parameters (Y, P, S) are generated in real-time based on a shared index.

•Zero-Key Exchange: No secret keys are transmitted over the air. Even if an attacker intercepts the metadata (k), the internal mutation state remains invisible without the Master Seed.

RSME uses index-based PRNG jumping to handle packet loss, ensuring re-synchronization without handshakes.

 

 

!!I've got the C code for the drone's encryption and decryption ready.

 

 

Here if you want to discuss about RSME:

https://news.ycombinator.com/threads?id=RanggaS

Notes

This project is open for modification and optimization. As the architect, I invite researchers and developers to refine the cryptographic formulas and implementation. All contributions that advance the 'Reactive Stability' concept are highly encouraged.

Technical info

#include <stdint.h>
#include <stdio.h>

// Struktur paket data yang ringkas (Bit-Packing)
typedef struct {
    uint32_t ciphertext;
    uint8_t k;         // Konstanta restorasi
    uint8_t packet_id; // Untuk sinkronisasi (0-255)
} RSME_Packet;

// Konfigurasi: Modulus pangkat dua (2^16) untuk kecepatan Bitwise
#define M_BITMASK 0xFFFF 
#define M_VALUE 65536

// Fungsi Enkripsi
RSME_Packet rsme_encrypt_v21(uint32_t data, uint32_t Y, uint32_t P, uint32_t S, uint8_t id) {
    RSME_Packet pkg;
    
    // Aljabar dasar + XOR (Reactive Stability)
    uint64_t pre_mod = ((uint64_t)data * Y - P) ^ S;
    
    // Bitwise Modulo (Jauh lebih cepat dari %)
    pkg.ciphertext = (uint32_t)(pre_mod & M_BITMASK);
    pkg.k = (uint8_t)(pre_mod / M_VALUE); 
    pkg.packet_id = id;
    
    return pkg;
}

// Fungsi Dekripsi
uint32_t rsme_decrypt_v21(RSME_Packet pkg, uint32_t Y, uint32_t P, uint32_t S) {
    // Restorasi menggunakan k
    uint64_t restored = (uint64_t)pkg.ciphertext + ((uint64_t)pkg.k * M_VALUE);
    
    // Balikkan XOR dan Aljabar
    uint32_t data = (uint32_t)(((restored ^ S) + P) / Y);
    
    return data;
}

int main() {
    uint32_t original_data = 12345;
    uint32_t Y=7, P=100, S=555; // Ini harusnya bermutasi via PRNG
    uint8_t current_id = 1;

    // Test Jalankan
    RSME_Packet encrypted = rsme_encrypt_v21(original_data, Y, P, S, current_id);
    uint32_t decrypted = rsme_decrypt_v21(encrypted, Y, P, S);

    printf("Original: %u\n", original_data);
    printf("Decrypted: %u\n", decrypted);
    printf("Paket ID: %u | Metadata k: %u\n", encrypted.packet_id, encrypted.k);

    return 0;
}

Update v2.1

The logic below is the C implementation of RSME for high-performance hardware (UAV/IoT).

Files

RSME_Reactive_Encryption_Technical_Specification.pdf

Files (46.6 kB)