libfcrypt 1.1.0__py3-none-any.whl

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.
libfcrypt/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ VERSION="1.1.0"
2
+ LICENSE="MIT"
3
+
4
+ import base as base
5
+ import file as file
libfcrypt/base.py ADDED
@@ -0,0 +1,19 @@
1
+ import base64
2
+ import hashlib
3
+
4
+ from cryptography.fernet import Fernet
5
+
6
+
7
+ def gen_key() -> bytes:
8
+ return Fernet.generate_key()
9
+
10
+ def passwd_gen_key(passwd:str) -> bytes:
11
+ hashed_passwd = hashlib.sha256(passwd.encode()).digest()
12
+ encoded_passwd = base64.urlsafe_b64encode(hashed_passwd)
13
+ return encoded_passwd
14
+
15
+ def encrypts(key:bytes,string:str) -> bytes:
16
+ return Fernet(key).encrypt(string.encode())
17
+
18
+ def decrypts(key:bytes,bytestring:bytes) -> str:
19
+ return Fernet(key).decrypt(bytestring).decode()
libfcrypt/file.py ADDED
@@ -0,0 +1,8 @@
1
+ from libfcrypt.base import decrypts, encrypts
2
+
3
+
4
+ def encryptf(key,filePtr):
5
+ return encrypts(key,filePtr.read())
6
+
7
+ def decryptf(key,filePtr):
8
+ return decrypts(key,filePtr.read())
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.5
2
+ Name: libfcrypt
3
+ Version: 1.1.0
4
+ Summary: Simple, symmetric encryption. Courtesy of Fernet.
5
+ Project-URL: Homepage, https://www.github.com/SrFluff/libfcrypt
6
+ Project-URL: Issues, https://www.github.com/SrFluff/libfcrypt/issues
7
+ Author-email: Franco Magnano <fluffins009@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.9.1
13
+ Description-Content-Type: text/markdown
14
+
15
+ # LibFcrypt
16
+
17
+ Simple, symmetric encryption. Courtesy of cryptography and Fernet.
18
+
19
+ ## Functions
20
+
21
+ ### Base
22
+
23
+ - `base.gen_key()`: Generate a bytes object key.
24
+ - `base.passwd_gen_key(passwd)`: Generate a bytes object key derived from a string.
25
+ - `base.encrypts(key,string)`: Encrypt a string using a key (bytes), returns a bytes object.
26
+ - `base.decrypts(key,string)`: Decrypt a string using a key (bytes), returns a string.
27
+
28
+ ### File
29
+
30
+ - `file.encryptf(key,filePtr)`: Encrypt the contents of a file using a key (bytes), returns a bytes object.
31
+ - `file.decryptf(key,filePtr)`: Decrypt the contents of a file using a key (bytes), returns a string.
32
+
33
+ ## Variables
34
+
35
+ - `VERSION`: Module version information, string.
36
+ - `LICENSE`: Module licensing information, string.
37
+
38
+ ## Installation
39
+
40
+ Copy the `libfcrypt/` directory to your `$PYTHONPATH` directory, and import it like so:
41
+ ```python
42
+ import libfcrypt
43
+
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ ```python
49
+ import libfcrypt
50
+
51
+ # Generate a key
52
+ key = libfcrypt.base.gen_key()
53
+
54
+ # Encrypt a string
55
+ secrets = libfcrypt.encrypts(key,"I have so many secrets muahaha!")
56
+
57
+ # Write secrets to a file
58
+ with open("Secrets.txt","wb") as f:
59
+ f.write(secrets)
60
+
61
+ # Read secrets from a file
62
+
63
+ f = open("Secrets.txt","rb")
64
+ spilled_secrets = libfcrypt.file.decryptf(key,f)
65
+
66
+ # Spill secrets!
67
+
68
+ print(spilled_secrets)
69
+ ```
@@ -0,0 +1,7 @@
1
+ libfcrypt/__init__.py,sha256=MRgjwekkhPaz-mg3OqfxZYnmioqI1qU4lhBdl201wK8,71
2
+ libfcrypt/base.py,sha256=Xp4T2wvFLcHKWtI4jrvk_aOtuVRSPdmBiebMPjhsWv0,514
3
+ libfcrypt/file.py,sha256=wBXH_c8gN3o4mZros1HXWvtozcFlpQbUmFXJEC_FehE,183
4
+ libfcrypt-1.1.0.dist-info/METADATA,sha256=zLVC935ru5j6dXcMyzuzfkua76FJiVynJwDGPa1to-0,1809
5
+ libfcrypt-1.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
6
+ libfcrypt-1.1.0.dist-info/licenses/LICENSE,sha256=uxgPZpiDJUAyjuU1MyKiP6s5P6oM4NCBwkLL-XyDIX0,1063
7
+ libfcrypt-1.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Franco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.