byharbor 1.3.2__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.
@@ -0,0 +1,61 @@
1
+ import base64
2
+ import os
3
+
4
+ from cryptography.hazmat.primitives import hashes
5
+ from cryptography.hazmat.primitives.ciphers.aead import AESGCM
6
+ from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
7
+
8
+ ALPHABET = ""
9
+ AES_PREFIX = "HBAES1:"
10
+ SALT_SIZE = 16
11
+ NONCE_SIZE = 12
12
+ KEY_SIZE = 32
13
+ KDF_ITERATIONS = 390000
14
+
15
+
16
+ def valid_key(key, alphabet=None):
17
+ return bool(key)
18
+
19
+
20
+ def _key(key, salt):
21
+ return PBKDF2HMAC(
22
+ algorithm=hashes.SHA256(),
23
+ length=KEY_SIZE,
24
+ salt=salt,
25
+ iterations=KDF_ITERATIONS,
26
+ ).derive(key.encode("utf-8"))
27
+
28
+
29
+ def BCB_bytes_text(path):
30
+ with open(path, "rb") as file:
31
+ return base64.b64encode(file.read()).decode("ascii")
32
+
33
+
34
+ def BCB_text_bytes(path):
35
+ with open(path, "r", encoding="utf-8") as file:
36
+ return base64.b64decode(file.read())
37
+
38
+
39
+ def BCB_Cryptography_bytes_passwd(text, key, iv=None):
40
+ salt = os.urandom(SALT_SIZE)
41
+ nonce = os.urandom(NONCE_SIZE)
42
+ encrypted = AESGCM(_key(key, salt)).encrypt(
43
+ nonce,
44
+ text.encode("utf-8"),
45
+ None,
46
+ )
47
+ payload = base64.b64encode(salt + nonce + encrypted).decode("ascii")
48
+ return AES_PREFIX + payload
49
+
50
+
51
+ def BCB_Descryptography_bytes_passwd(text, key, iv=None):
52
+ if not text.startswith(AES_PREFIX):
53
+ raise ValueError("Unsupported encrypted file format.")
54
+
55
+ payload = base64.b64decode(text[len(AES_PREFIX) :])
56
+ salt = payload[:SALT_SIZE]
57
+ nonce = payload[SALT_SIZE : SALT_SIZE + NONCE_SIZE]
58
+ encrypted = payload[SALT_SIZE + NONCE_SIZE :]
59
+
60
+ decrypted = AESGCM(_key(key, salt)).decrypt(nonce, encrypted, None)
61
+ return decrypted.decode("utf-8")
@@ -0,0 +1,20 @@
1
+ from hashlib import sha256
2
+
3
+
4
+ def hash_text(entry):
5
+ """Return the SHA-256 hex digest for a text value."""
6
+ encoded = sha256(entry.encode("utf-8"))
7
+ return encoded.hexdigest()
8
+
9
+
10
+ def ultra_hash(entry):
11
+ """Hash each character first, then hash the joined result."""
12
+ hashes = []
13
+ entry_chars = list(entry)
14
+
15
+ for char in entry_chars:
16
+ output = hash_text(char)
17
+ hashes.append(output)
18
+
19
+ final_output = hash_text("".join(hashes))
20
+ return final_output
@@ -0,0 +1,27 @@
1
+ from ContainerStuff.Obsidian.BaseSystem.crypto import (
2
+ ALPHABET,
3
+ BCB_bytes_text,
4
+ BCB_Cryptography_bytes_passwd,
5
+ BCB_Descryptography_bytes_passwd,
6
+ valid_key,
7
+ )
8
+
9
+
10
+ def main_bcb_crypt_flux_v1(path, password):
11
+ """Read a file and return its encrypted Base64 payload."""
12
+ if valid_key(password, ALPHABET) is True:
13
+ file_bytes = BCB_bytes_text(path)
14
+ return BCB_Cryptography_bytes_passwd(file_bytes, password)
15
+
16
+ return None
17
+
18
+
19
+ def main_bcb_decrypt_flux_v1(path, password):
20
+ """Read an encrypted file and return its decrypted Base64 payload."""
21
+ if valid_key(password, ALPHABET) is True:
22
+ with open(path, encoding="utf-8") as file:
23
+ encrypted_text = file.read()
24
+
25
+ return BCB_Descryptography_bytes_passwd(encrypted_text, password)
26
+
27
+ return None
@@ -0,0 +1,400 @@
1
+ # ============================================================
2
+ # OPERATING SYSTEM
3
+ # ============================================================
4
+
5
+ .DS_Store
6
+ .DS_Store?
7
+ ._*
8
+ .Spotlight-V100
9
+ .Trashes
10
+ .fseventsd
11
+
12
+ Thumbs.db
13
+ Thumbs.db:encryptable
14
+ ehthumbs.db
15
+ Desktop.ini
16
+
17
+ Icon?
18
+ $RECYCLE.BIN/
19
+
20
+ # ============================================================
21
+ # IDE / EDITORS
22
+ # ============================================================
23
+
24
+ .vscode/
25
+ .idea/
26
+ *.iml
27
+
28
+ # Vim
29
+ *.swp
30
+ *.swo
31
+ *.swn
32
+ *~
33
+
34
+ # Emacs
35
+ .#*
36
+ #*#
37
+
38
+ # Sublime Text
39
+ *.sublime-workspace
40
+ *.sublime-project
41
+
42
+ # Visual Studio
43
+ .vs/
44
+ *.user
45
+ *.suo
46
+ *.userosscache
47
+ *.sln.docstates
48
+
49
+ # JetBrains
50
+ .idea/
51
+
52
+ # Eclipse
53
+ .classpath
54
+ .project
55
+ .settings/
56
+
57
+ # ============================================================
58
+ # TEMPORARY / BACKUP FILES
59
+ # ============================================================
60
+
61
+ *.tmp
62
+ *.temp
63
+ *.bak
64
+ *.backup
65
+ *.old
66
+ *.orig
67
+ *.rej
68
+
69
+ tmp/
70
+ temp/
71
+ .tmp/
72
+
73
+ # ============================================================
74
+ # LOGS
75
+ # ============================================================
76
+
77
+ *.log
78
+ logs/
79
+ log/
80
+
81
+ # ============================================================
82
+ # CACHE
83
+ # ============================================================
84
+
85
+ .cache/
86
+ .cache-loader/
87
+ .parcel-cache/
88
+ .eslintcache
89
+ .rpt2_cache/
90
+ .sass-cache/
91
+ .yarn-cache/
92
+
93
+ # ============================================================
94
+ # PYTHON
95
+ # ============================================================
96
+
97
+ __pycache__/
98
+ *.py[cod]
99
+ *$py.class
100
+
101
+ .pytest_cache/
102
+ .mypy_cache/
103
+ .pyre/
104
+ .pytype/
105
+ .pyright/
106
+
107
+ .ruff_cache/
108
+ .tox/
109
+ .nox/
110
+ .coverage
111
+ .coverage.*
112
+ htmlcov/
113
+
114
+ .venv/
115
+ venv/
116
+ env/
117
+ ENV/
118
+
119
+ *.egg-info/
120
+ .eggs/
121
+
122
+ build/
123
+ dist/
124
+
125
+ .ipynb_checkpoints/
126
+
127
+ # ============================================================
128
+ # JAVASCRIPT / NODE
129
+ # ============================================================
130
+
131
+ node_modules/
132
+
133
+ .npm/
134
+ .pnpm-store/
135
+ .yarn/
136
+ .yarn-cache/
137
+
138
+ npm-debug.log*
139
+ yarn-debug.log*
140
+ yarn-error.log*
141
+ pnpm-debug.log*
142
+
143
+ # Build outputs
144
+ .next/
145
+ .nuxt/
146
+ .svelte-kit/
147
+ .turbo/
148
+ .vercel/
149
+ .netlify/
150
+
151
+ # ============================================================
152
+ # RUST
153
+ # ============================================================
154
+
155
+ target/
156
+
157
+ # ============================================================
158
+ # GO
159
+ # ============================================================
160
+
161
+ bin/
162
+
163
+ # ============================================================
164
+ # JAVA / JVM
165
+ # ============================================================
166
+
167
+ *.class
168
+
169
+ target/
170
+ .gradle/
171
+ .gradle-cache/
172
+
173
+ # ============================================================
174
+ # KOTLIN
175
+ # ============================================================
176
+
177
+ .kotlin/
178
+
179
+ # ============================================================
180
+ # C / C++
181
+ # ============================================================
182
+
183
+ # Common build directories
184
+ cmake-build-*/
185
+ CMakeFiles/
186
+ CMakeCache.txt
187
+ compile_commands.json
188
+ Makefile
189
+
190
+ *.o
191
+ *.obj
192
+ *.a
193
+ *.lib
194
+ *.so
195
+ *.dll
196
+ *.dylib
197
+
198
+ # ============================================================
199
+ # .NET / C#
200
+ # ============================================================
201
+
202
+ bin/
203
+ obj/
204
+
205
+ .vs/
206
+
207
+ *.user
208
+ *.suo
209
+
210
+ # ============================================================
211
+ # SWIFT / XCODE
212
+ # ============================================================
213
+
214
+ DerivedData/
215
+ .build/
216
+ .swiftpm/
217
+ *.xcuserstate
218
+
219
+ Pods/
220
+
221
+ # ============================================================
222
+ # PHP
223
+ # ============================================================
224
+
225
+ vendor/
226
+
227
+ .phpunit.result.cache
228
+
229
+ # ============================================================
230
+ # RUBY
231
+ # ============================================================
232
+
233
+ .bundle/
234
+ vendor/bundle/
235
+
236
+ *.gem
237
+
238
+ # ============================================================
239
+ # DART / FLUTTER
240
+ # ============================================================
241
+
242
+ .dart_tool/
243
+ .flutter-plugins
244
+ .flutter-plugins-dependencies
245
+ .pub-cache/
246
+ .packages
247
+
248
+ # ============================================================
249
+ # ELIXIR / ERLANG
250
+ # ============================================================
251
+
252
+ _build/
253
+ deps/
254
+ .coverage/
255
+
256
+ # ============================================================
257
+ # HASKELL
258
+ # ============================================================
259
+
260
+ .stack-work/
261
+ dist-newstyle/
262
+
263
+ # ============================================================
264
+ # R
265
+ # ============================================================
266
+
267
+ .Rhistory
268
+ .RData
269
+ .Ruserdata
270
+
271
+ # ============================================================
272
+ # LUA
273
+ # ============================================================
274
+
275
+ luarocks/
276
+
277
+ # ============================================================
278
+ # MATLAB
279
+ # ============================================================
280
+
281
+ *.asv
282
+
283
+ # ============================================================
284
+ # TERRAFORM
285
+ # ============================================================
286
+
287
+ .terraform/
288
+ *.tfstate
289
+ *.tfstate.*
290
+
291
+ # ============================================================
292
+ # KUBERNETES
293
+ # ============================================================
294
+
295
+ .kube/
296
+
297
+ # ============================================================
298
+ # DOCKER
299
+ # ============================================================
300
+
301
+ docker-data/
302
+ docker-volumes/
303
+
304
+ # ============================================================
305
+ # CREDENTIALS / SECRETS
306
+ # ============================================================
307
+
308
+ .env
309
+ .env.*
310
+ !.env.example
311
+ !.env.template
312
+
313
+ *.pem
314
+ *.key
315
+ *.secret
316
+ *.secrets
317
+
318
+ # ============================================================
319
+ # DATABASE / LOCAL DATA
320
+ # ============================================================
321
+
322
+ *.sqlite
323
+ *.sqlite3
324
+ *.db
325
+
326
+ # ============================================================
327
+ # BUILD / DISTRIBUTION
328
+ # ============================================================
329
+
330
+ build/
331
+ dist/
332
+ out/
333
+ output/
334
+ release/
335
+
336
+ # ============================================================
337
+ # COVERAGE / TEST RESULTS
338
+ # ============================================================
339
+
340
+ coverage/
341
+ .coverage
342
+ coverage.xml
343
+ htmlcov/
344
+
345
+ test-results/
346
+ test-results.xml
347
+ junit.xml
348
+
349
+ # ============================================================
350
+ # PACKAGE MANAGERS
351
+ # ============================================================
352
+
353
+ vendor/
354
+ packages/
355
+
356
+ # ============================================================
357
+ # GENERATED DOCUMENTATION
358
+ # ============================================================
359
+
360
+ docs/_build/
361
+
362
+ # ============================================================
363
+ # LOCAL CONFIGURATION
364
+ # ============================================================
365
+
366
+ .local/
367
+ .local.*
368
+
369
+ # ============================================================
370
+ # ARCHIVES
371
+ # ============================================================
372
+
373
+ *.zip
374
+ *.tar
375
+ *.tar.gz
376
+ *.tgz
377
+ *.rar
378
+ *.7z
379
+
380
+ # ============================================================
381
+ # COMPILED / BINARY OUTPUT
382
+ # ============================================================
383
+
384
+ *.exe
385
+ *.dll
386
+ *.so
387
+ *.dylib
388
+ *.class
389
+ *.o
390
+ *.obj
391
+ *.a
392
+ *.lib
393
+
394
+ # ============================================================
395
+ # OS / TOOLING LOCK / PID FILES
396
+ # ============================================================
397
+
398
+ *.pid
399
+ *.pid.lock
400
+ *.seed