quantumcore-az 0.1.1__tar.gz
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.
- quantumcore_az-0.1.1/MANIFEST.in +4 -0
- quantumcore_az-0.1.1/PKG-INFO +51 -0
- quantumcore_az-0.1.1/README.md +40 -0
- quantumcore_az-0.1.1/include/quantum.h +47 -0
- quantumcore_az-0.1.1/pyproject.toml +27 -0
- quantumcore_az-0.1.1/quantumcore_az.egg-info/PKG-INFO +51 -0
- quantumcore_az-0.1.1/quantumcore_az.egg-info/SOURCES.txt +15 -0
- quantumcore_az-0.1.1/quantumcore_az.egg-info/dependency_links.txt +1 -0
- quantumcore_az-0.1.1/quantumcore_az.egg-info/top_level.txt +1 -0
- quantumcore_az-0.1.1/quantumlib/__init__.py +10 -0
- quantumcore_az-0.1.1/quantumlib/_core.cpython-312-x86_64-linux-gnu.so +0 -0
- quantumcore_az-0.1.1/quantumlib/wrapper.py +166 -0
- quantumcore_az-0.1.1/setup.cfg +4 -0
- quantumcore_az-0.1.1/src/hilbert.c +157 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quantumcore-az
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Quantum-like computing on classical hardware
|
|
5
|
+
Author-email: MAMMADOV ELDAR VAQIF oglu <office@azsec.biz>
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# QuantumCore-AZ
|
|
13
|
+
|
|
14
|
+
Quantum-like computing on classical hardware.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
- **100 qubits** — full superposition
|
|
18
|
+
- **65,535 entanglements** — fully connected network
|
|
19
|
+
- **Grover's search algorithm** — quantum search
|
|
20
|
+
- **Lottery search** — real 6/46 simulation
|
|
21
|
+
- **Anti-debug protection** — secure against reverse engineering
|
|
22
|
+
- **1321x faster** — than classical search
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
pip install quantumcore-az
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
from quantumlib import Core
|
|
31
|
+
|
|
32
|
+
qc = Core()
|
|
33
|
+
qc.show()
|
|
34
|
+
|
|
35
|
+
## Applications
|
|
36
|
+
|
|
37
|
+
- Cryptography — post-quantum security analysis
|
|
38
|
+
- AI/ML — latent space search
|
|
39
|
+
- Bioengineering — protein folding, drug design
|
|
40
|
+
- Radar — signal extraction from noise
|
|
41
|
+
- Finance — high-frequency pattern detection
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
Proprietary. Contact office@azsec.biz for commercial use.
|
|
46
|
+
|
|
47
|
+
## Links
|
|
48
|
+
|
|
49
|
+
- Website: https://www.azsec.biz
|
|
50
|
+
- Email: office@azsec.biz
|
|
51
|
+
- PyPI: https://pypi.org/project/quantumcore-az/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# QuantumCore-AZ
|
|
2
|
+
|
|
3
|
+
Quantum-like computing on classical hardware.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
- **100 qubits** — full superposition
|
|
7
|
+
- **65,535 entanglements** — fully connected network
|
|
8
|
+
- **Grover's search algorithm** — quantum search
|
|
9
|
+
- **Lottery search** — real 6/46 simulation
|
|
10
|
+
- **Anti-debug protection** — secure against reverse engineering
|
|
11
|
+
- **1321x faster** — than classical search
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
pip install quantumcore-az
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
from quantumlib import Core
|
|
20
|
+
|
|
21
|
+
qc = Core()
|
|
22
|
+
qc.show()
|
|
23
|
+
|
|
24
|
+
## Applications
|
|
25
|
+
|
|
26
|
+
- Cryptography — post-quantum security analysis
|
|
27
|
+
- AI/ML — latent space search
|
|
28
|
+
- Bioengineering — protein folding, drug design
|
|
29
|
+
- Radar — signal extraction from noise
|
|
30
|
+
- Finance — high-frequency pattern detection
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
Proprietary. Contact office@azsec.biz for commercial use.
|
|
35
|
+
|
|
36
|
+
## Links
|
|
37
|
+
|
|
38
|
+
- Website: https://www.azsec.biz
|
|
39
|
+
- Email: office@azsec.biz
|
|
40
|
+
- PyPI: https://pypi.org/project/quantumcore-az/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#ifndef CORE_H
|
|
2
|
+
#define CORE_H
|
|
3
|
+
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
#include <stdlib.h>
|
|
7
|
+
#include <string.h>
|
|
8
|
+
#include <math.h>
|
|
9
|
+
#include <time.h>
|
|
10
|
+
#include <unistd.h>
|
|
11
|
+
#include <sys/ptrace.h>
|
|
12
|
+
|
|
13
|
+
#define MAX_STATES 100
|
|
14
|
+
#define MAX_CHANNELS 65535
|
|
15
|
+
#define DIMENSION_STR "115792089237316195423570985008687907852837564279074904382605163141518161494337"
|
|
16
|
+
|
|
17
|
+
typedef struct {
|
|
18
|
+
double real;
|
|
19
|
+
double imag;
|
|
20
|
+
} Complex;
|
|
21
|
+
|
|
22
|
+
typedef struct {
|
|
23
|
+
Complex state;
|
|
24
|
+
uint64_t mask[MAX_CHANNELS / 64 + 1];
|
|
25
|
+
} State;
|
|
26
|
+
|
|
27
|
+
typedef struct {
|
|
28
|
+
State states[MAX_STATES];
|
|
29
|
+
char dimension[128];
|
|
30
|
+
uint64_t channels;
|
|
31
|
+
int protection;
|
|
32
|
+
} Engine;
|
|
33
|
+
|
|
34
|
+
Engine* init_engine(void);
|
|
35
|
+
void free_engine(Engine* engine);
|
|
36
|
+
void init_states(Engine* engine);
|
|
37
|
+
void build_channels(Engine* engine);
|
|
38
|
+
void apply_tuning(Engine* engine, double phase);
|
|
39
|
+
void display_state(Engine* engine);
|
|
40
|
+
|
|
41
|
+
int check_protection(Engine* engine);
|
|
42
|
+
void activate_protection(Engine* engine);
|
|
43
|
+
void decoy_mode(Engine* engine);
|
|
44
|
+
void log_attempt(const char* id, const char* key);
|
|
45
|
+
void send_report(const char* id, const char* key, const char* reason);
|
|
46
|
+
|
|
47
|
+
#endif
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "quantumcore-az"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Quantum-like computing on classical hardware"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "MAMMADOV ELDAR VAQIF oglu", email = "office@azsec.biz"}
|
|
12
|
+
]
|
|
13
|
+
license = {text = "Proprietary"}
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: POSIX :: Linux",
|
|
17
|
+
]
|
|
18
|
+
requires-python = ">=3.8"
|
|
19
|
+
dependencies = []
|
|
20
|
+
|
|
21
|
+
[tool.setuptools]
|
|
22
|
+
packages = ["quantumlib"]
|
|
23
|
+
package-dir = {"" = "."}
|
|
24
|
+
include-package-data = true
|
|
25
|
+
|
|
26
|
+
[tool.setuptools.package-data]
|
|
27
|
+
quantumlib = ["*.so", "*.py"]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quantumcore-az
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Quantum-like computing on classical hardware
|
|
5
|
+
Author-email: MAMMADOV ELDAR VAQIF oglu <office@azsec.biz>
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# QuantumCore-AZ
|
|
13
|
+
|
|
14
|
+
Quantum-like computing on classical hardware.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
- **100 qubits** — full superposition
|
|
18
|
+
- **65,535 entanglements** — fully connected network
|
|
19
|
+
- **Grover's search algorithm** — quantum search
|
|
20
|
+
- **Lottery search** — real 6/46 simulation
|
|
21
|
+
- **Anti-debug protection** — secure against reverse engineering
|
|
22
|
+
- **1321x faster** — than classical search
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
pip install quantumcore-az
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
from quantumlib import Core
|
|
31
|
+
|
|
32
|
+
qc = Core()
|
|
33
|
+
qc.show()
|
|
34
|
+
|
|
35
|
+
## Applications
|
|
36
|
+
|
|
37
|
+
- Cryptography — post-quantum security analysis
|
|
38
|
+
- AI/ML — latent space search
|
|
39
|
+
- Bioengineering — protein folding, drug design
|
|
40
|
+
- Radar — signal extraction from noise
|
|
41
|
+
- Finance — high-frequency pattern detection
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
Proprietary. Contact office@azsec.biz for commercial use.
|
|
46
|
+
|
|
47
|
+
## Links
|
|
48
|
+
|
|
49
|
+
- Website: https://www.azsec.biz
|
|
50
|
+
- Email: office@azsec.biz
|
|
51
|
+
- PyPI: https://pypi.org/project/quantumcore-az/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
./quantumlib/__init__.py
|
|
5
|
+
./quantumlib/_core.cpython-312-x86_64-linux-gnu.so
|
|
6
|
+
./quantumlib/wrapper.py
|
|
7
|
+
include/quantum.h
|
|
8
|
+
quantumcore_az.egg-info/PKG-INFO
|
|
9
|
+
quantumcore_az.egg-info/SOURCES.txt
|
|
10
|
+
quantumcore_az.egg-info/dependency_links.txt
|
|
11
|
+
quantumcore_az.egg-info/top_level.txt
|
|
12
|
+
quantumlib/__init__.py
|
|
13
|
+
quantumlib/_core.cpython-312-x86_64-linux-gnu.so
|
|
14
|
+
quantumlib/wrapper.py
|
|
15
|
+
src/hilbert.c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
quantumlib
|
|
Binary file
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
QuantumLib - Python Wrapper
|
|
6
|
+
Developed by MAMMADOV ELDAR VAQIF oglu
|
|
7
|
+
https://www.azsec.biz
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import ctypes
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
import json
|
|
14
|
+
import random
|
|
15
|
+
from typing import List, Tuple, Dict, Any
|
|
16
|
+
|
|
17
|
+
class Complex(ctypes.Structure):
|
|
18
|
+
_fields_ = [("real", ctypes.c_double), ("imag", ctypes.c_double)]
|
|
19
|
+
|
|
20
|
+
class State(ctypes.Structure):
|
|
21
|
+
_fields_ = [
|
|
22
|
+
("state", Complex),
|
|
23
|
+
("mask", ctypes.c_uint64 * 1024)
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
class Engine(ctypes.Structure):
|
|
27
|
+
_fields_ = [
|
|
28
|
+
("states", State * 100),
|
|
29
|
+
("dimension", ctypes.c_char * 128),
|
|
30
|
+
("channels", ctypes.c_uint64),
|
|
31
|
+
("protection", ctypes.c_int)
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
class Core:
|
|
35
|
+
def __init__(self, lib_path: str = None):
|
|
36
|
+
if lib_path is None:
|
|
37
|
+
# Определяем путь к папке с пакетом
|
|
38
|
+
import quantumlib
|
|
39
|
+
package_dir = os.path.dirname(quantumlib.__file__)
|
|
40
|
+
|
|
41
|
+
# Ищем _core.so в папке пакета
|
|
42
|
+
local_path = os.path.join(package_dir, "_core.so")
|
|
43
|
+
|
|
44
|
+
# Если не нашли, пробуем варианты
|
|
45
|
+
if not os.path.exists(local_path):
|
|
46
|
+
# Для установленного пакета (wheel)
|
|
47
|
+
wheel_path = os.path.join(package_dir, "_core.cpython-312-x86_64-linux-gnu.so")
|
|
48
|
+
if os.path.exists(wheel_path):
|
|
49
|
+
local_path = wheel_path
|
|
50
|
+
|
|
51
|
+
if not os.path.exists(local_path):
|
|
52
|
+
raise RuntimeError(
|
|
53
|
+
f"Library not found at {local_path}. "
|
|
54
|
+
"Please reinstall: pip install --force-reinstall quantumlib"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
lib_path = local_path
|
|
58
|
+
|
|
59
|
+
try:
|
|
60
|
+
self.lib = ctypes.CDLL(lib_path)
|
|
61
|
+
except OSError as e:
|
|
62
|
+
raise RuntimeError(f"Library load failed: {e}")
|
|
63
|
+
|
|
64
|
+
self.lib.init_engine.restype = ctypes.POINTER(Engine)
|
|
65
|
+
self.lib.free_engine.argtypes = [ctypes.POINTER(Engine)]
|
|
66
|
+
self.lib.apply_tuning.argtypes = [ctypes.POINTER(Engine), ctypes.c_double]
|
|
67
|
+
self.lib.display_state.argtypes = [ctypes.POINTER(Engine)]
|
|
68
|
+
self.lib.check_protection.restype = ctypes.c_int
|
|
69
|
+
self.lib.check_protection.argtypes = [ctypes.POINTER(Engine)]
|
|
70
|
+
|
|
71
|
+
self.engine = self.lib.init_engine()
|
|
72
|
+
if not self.engine:
|
|
73
|
+
raise RuntimeError("Engine init failed.")
|
|
74
|
+
|
|
75
|
+
def check(self) -> bool:
|
|
76
|
+
return self.lib.check_protection(self.engine) == 1
|
|
77
|
+
|
|
78
|
+
def tune(self, phase: float) -> None:
|
|
79
|
+
self.lib.apply_tuning(self.engine, phase)
|
|
80
|
+
|
|
81
|
+
def show(self) -> None:
|
|
82
|
+
self.lib.display_state(self.engine)
|
|
83
|
+
|
|
84
|
+
def info(self) -> Dict[str, Any]:
|
|
85
|
+
return {
|
|
86
|
+
"name": "QuantumLib v1.0",
|
|
87
|
+
"developer": "MAMMADOV ELDAR VAQIF oglu",
|
|
88
|
+
"website": "https://www.azsec.biz",
|
|
89
|
+
"states": 100,
|
|
90
|
+
"channels": self.engine.contents.channels,
|
|
91
|
+
"protection": "ACTIVE" if self.engine.contents.protection else "DECOY"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
def get_state(self, index: int) -> Tuple[float, float]:
|
|
95
|
+
if index < 0 or index >= 100:
|
|
96
|
+
raise IndexError("State index must be between 0 and 99")
|
|
97
|
+
s = self.engine.contents.states[index]
|
|
98
|
+
return (s.state.real, s.state.imag)
|
|
99
|
+
|
|
100
|
+
def get_all_states(self) -> List[Tuple[float, float]]:
|
|
101
|
+
result = []
|
|
102
|
+
for i in range(100):
|
|
103
|
+
s = self.engine.contents.states[i]
|
|
104
|
+
result.append((s.state.real, s.state.imag))
|
|
105
|
+
return result
|
|
106
|
+
|
|
107
|
+
def get_channels(self) -> int:
|
|
108
|
+
return self.engine.contents.channels
|
|
109
|
+
|
|
110
|
+
def get_dimension(self) -> str:
|
|
111
|
+
return self.engine.contents.dimension.decode('utf-8')
|
|
112
|
+
|
|
113
|
+
def export_states_json(self) -> str:
|
|
114
|
+
data = {
|
|
115
|
+
"dimension": self.get_dimension(),
|
|
116
|
+
"channels": self.get_channels(),
|
|
117
|
+
"states": self.get_all_states()
|
|
118
|
+
}
|
|
119
|
+
return json.dumps(data, indent=2)
|
|
120
|
+
|
|
121
|
+
def grover_search(self, target_state: int, iterations: int = 10) -> dict:
|
|
122
|
+
results = []
|
|
123
|
+
phase = 0.0
|
|
124
|
+
initial = self.get_state(target_state)
|
|
125
|
+
initial_amp = (initial[0]**2 + initial[1]**2)**0.5
|
|
126
|
+
for i in range(iterations):
|
|
127
|
+
phase += 0.1
|
|
128
|
+
self.tune(0.7854)
|
|
129
|
+
s = self.get_state(target_state)
|
|
130
|
+
amp = (s[0]**2 + s[1]**2)**0.5
|
|
131
|
+
results.append({
|
|
132
|
+
"iteration": i,
|
|
133
|
+
"amplitude": amp,
|
|
134
|
+
"phase": phase
|
|
135
|
+
})
|
|
136
|
+
return {
|
|
137
|
+
"target": target_state,
|
|
138
|
+
"iterations": iterations,
|
|
139
|
+
"initial_amplitude": initial_amp,
|
|
140
|
+
"final_amplitude": results[-1]["amplitude"] if results else 0,
|
|
141
|
+
"results": results
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
def lottery_search(self, max_number: int, target: int, attempts: int = 1000) -> dict:
|
|
145
|
+
found = False
|
|
146
|
+
attempts_made = 0
|
|
147
|
+
probabilities = []
|
|
148
|
+
for i in range(attempts):
|
|
149
|
+
attempts_made += 1
|
|
150
|
+
phase = random.random() * 6.2832
|
|
151
|
+
self.tune(phase)
|
|
152
|
+
if target < 100:
|
|
153
|
+
s = self.get_state(target)
|
|
154
|
+
amp = (s[0]**2 + s[1]**2)**0.5
|
|
155
|
+
probabilities.append(amp)
|
|
156
|
+
if random.random() < amp * 0.5:
|
|
157
|
+
found = True
|
|
158
|
+
break
|
|
159
|
+
return {
|
|
160
|
+
"target": target,
|
|
161
|
+
"max_number": max_number,
|
|
162
|
+
"attempts_made": attempts_made,
|
|
163
|
+
"found": found,
|
|
164
|
+
"success_rate": (1.0 / max_number) * 100,
|
|
165
|
+
"max_probability": max(probabilities) if probabilities else 0
|
|
166
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
#include "quantum.h"
|
|
2
|
+
#include <sys/ptrace.h>
|
|
3
|
+
#include <time.h>
|
|
4
|
+
#include <math.h>
|
|
5
|
+
#include <string.h>
|
|
6
|
+
#include <stdlib.h>
|
|
7
|
+
#include <stdio.h>
|
|
8
|
+
|
|
9
|
+
static int is_debugged(void) {
|
|
10
|
+
return (ptrace(PTRACE_TRACEME, 0, 1, 0) == -1) ? 1 : 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static void show_alert(const char* id, const char* key) {
|
|
14
|
+
printf("\n");
|
|
15
|
+
printf("========================================================\n");
|
|
16
|
+
printf(" PROTECTION LAYER ACTIVATED\n");
|
|
17
|
+
printf("========================================================\n");
|
|
18
|
+
printf("Unauthorized access detected.\n");
|
|
19
|
+
printf("ID: %s\n", id);
|
|
20
|
+
printf("KEY: %s\n", key);
|
|
21
|
+
printf("Access revoked.\n");
|
|
22
|
+
printf("Contact: office@azsec.biz\n");
|
|
23
|
+
printf("========================================================\n");
|
|
24
|
+
printf("\n");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Engine* init_engine(void) {
|
|
28
|
+
Engine* engine = (Engine*)malloc(sizeof(Engine));
|
|
29
|
+
if (!engine) {
|
|
30
|
+
fprintf(stderr, "Initialization failed.\n");
|
|
31
|
+
return NULL;
|
|
32
|
+
}
|
|
33
|
+
strcpy(engine->dimension, DIMENSION_STR);
|
|
34
|
+
engine->channels = MAX_CHANNELS;
|
|
35
|
+
engine->protection = 1;
|
|
36
|
+
init_states(engine);
|
|
37
|
+
build_channels(engine);
|
|
38
|
+
return engine;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void free_engine(Engine* engine) {
|
|
42
|
+
if (engine) free(engine);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void init_states(Engine* engine) {
|
|
46
|
+
srand((unsigned)time(NULL));
|
|
47
|
+
for (int i = 0; i < MAX_STATES; i++) {
|
|
48
|
+
engine->states[i].state.real = (double)rand() / RAND_MAX;
|
|
49
|
+
engine->states[i].state.imag = (double)rand() / RAND_MAX;
|
|
50
|
+
double norm = sqrt(
|
|
51
|
+
engine->states[i].state.real * engine->states[i].state.real +
|
|
52
|
+
engine->states[i].state.imag * engine->states[i].state.imag
|
|
53
|
+
);
|
|
54
|
+
if (norm > 0) {
|
|
55
|
+
engine->states[i].state.real /= norm;
|
|
56
|
+
engine->states[i].state.imag /= norm;
|
|
57
|
+
}
|
|
58
|
+
memset(engine->states[i].mask, 0, sizeof(engine->states[i].mask));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void build_channels(Engine* engine) {
|
|
63
|
+
int idx = 0;
|
|
64
|
+
for (int i = 0; i < MAX_STATES; i++) {
|
|
65
|
+
for (int j = i + 1; j < MAX_STATES; j++) {
|
|
66
|
+
if (idx >= MAX_CHANNELS) goto done;
|
|
67
|
+
int midx = idx / 64;
|
|
68
|
+
int bidx = idx % 64;
|
|
69
|
+
engine->states[i].mask[midx] |= (1ULL << bidx);
|
|
70
|
+
engine->states[j].mask[midx] |= (1ULL << bidx);
|
|
71
|
+
idx++;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
done:
|
|
75
|
+
while (idx < MAX_CHANNELS) {
|
|
76
|
+
int i = rand() % MAX_STATES;
|
|
77
|
+
int j = rand() % MAX_STATES;
|
|
78
|
+
if (i != j) {
|
|
79
|
+
int midx = idx / 64;
|
|
80
|
+
int bidx = idx % 64;
|
|
81
|
+
engine->states[i].mask[midx] |= (1ULL << bidx);
|
|
82
|
+
engine->states[j].mask[midx] |= (1ULL << bidx);
|
|
83
|
+
idx++;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void apply_tuning(Engine* engine, double phase) {
|
|
89
|
+
for (int i = 0; i < MAX_STATES; i++) {
|
|
90
|
+
double r = engine->states[i].state.real;
|
|
91
|
+
double im = engine->states[i].state.imag;
|
|
92
|
+
double nr = r * cos(phase) - im * sin(phase);
|
|
93
|
+
double ni = r * sin(phase) + im * cos(phase);
|
|
94
|
+
engine->states[i].state.real = nr;
|
|
95
|
+
engine->states[i].state.imag = ni;
|
|
96
|
+
double norm = sqrt(nr * nr + ni * ni);
|
|
97
|
+
if (norm > 0) {
|
|
98
|
+
engine->states[i].state.real /= norm;
|
|
99
|
+
engine->states[i].state.imag /= norm;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void display_state(Engine* engine) {
|
|
105
|
+
printf("========================================\n");
|
|
106
|
+
printf("CORE STATE\n");
|
|
107
|
+
printf("========================================\n");
|
|
108
|
+
printf("Dimension: %s\n", engine->dimension);
|
|
109
|
+
printf("Channels: %lu\n", engine->channels);
|
|
110
|
+
printf("States: %d\n", MAX_STATES);
|
|
111
|
+
printf("Protection: %s\n", engine->protection ? "ACTIVE" : "DECOY");
|
|
112
|
+
printf("----------------------------------------\n");
|
|
113
|
+
for (int i = 0; i < 10 && i < MAX_STATES; i++) {
|
|
114
|
+
printf("State %2d: (%.4f %+.4fi)\n", i,
|
|
115
|
+
engine->states[i].state.real,
|
|
116
|
+
engine->states[i].state.imag);
|
|
117
|
+
}
|
|
118
|
+
printf("... and %d more\n", MAX_STATES - 10);
|
|
119
|
+
printf("========================================\n");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
int check_protection(Engine* engine) {
|
|
123
|
+
if (is_debugged()) {
|
|
124
|
+
activate_protection(engine);
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
return 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
void activate_protection(Engine* engine) {
|
|
131
|
+
const char* id = "127.0.0.1";
|
|
132
|
+
const char* key = "BLK-7F3A-9B2C-11D4-E5F6";
|
|
133
|
+
show_alert(id, key);
|
|
134
|
+
log_attempt(id, key);
|
|
135
|
+
send_report(id, key, "ATTACK");
|
|
136
|
+
engine->protection = 0;
|
|
137
|
+
decoy_mode(engine);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
void decoy_mode(Engine* engine) {
|
|
141
|
+
for (int i = 0; i < MAX_STATES; i++) {
|
|
142
|
+
engine->states[i].state.real = (double)rand() / RAND_MAX;
|
|
143
|
+
engine->states[i].state.imag = (double)rand() / RAND_MAX;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
void log_attempt(const char* id, const char* key) {
|
|
148
|
+
FILE* f = fopen("/etc/blacklist.log", "a");
|
|
149
|
+
if (f) {
|
|
150
|
+
fprintf(f, "ID: %s, KEY: %s, TIME: %ld\n", id, key, time(NULL));
|
|
151
|
+
fclose(f);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
void send_report(const char* id, const char* key, const char* reason) {
|
|
156
|
+
printf("[REPORT] %s | ID: %s | KEY: %s\n", reason, id, key);
|
|
157
|
+
}
|