Skip to main content


GCMlib - A minimalistic and simple encryption library. For encrypting data using AES GCM mode.

GCMlib allows you to encrypt and decrypt data via AES in GCM mode with a password derived key. Your encrypted data/strings can only be decrypted using the aformentioned key. You can use this for a variety of things from securing passwords, encrypting HWIDs and files. Making AES encryption a little bit easier!



Updates

What has been updated as of | 01/17/23:

  • Functions now take "keyword arguments" and gcm.py will enforce the "keyword arguments".


Installation

[Directly from here/this repo.]

[therealOri ~]$ pip install git+https://github.com/therealOri/GCMlib

or

[From Pypi.]

[therealOri ~]$ pip install GCMlib



Code Examples

If you would like to make this look better/more presentable. Please by all means make a pull request xD. I'm not the best with making things look great.

It is important to know that all functions will take 2 values in BYTES. The data to encrypt and the key. Make sure the data passed to the functions are in that order. Data first then Key.

The making of the "key" takes in a password (that you can make using Genter). The key then gets used to encrypt your data.


import gcm


##---------Start---------##

#Encrypting
data = b'Hello World <3'
key_data = b'abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde'

eKey = gcm.keygen(key_data) #Returns bytes and will return "None" if what's provided is less than 100 characters.
save_me = base64.b64encode(eKey) #for saving eKey to decrypt later.

input(f'Save this key so you can decrypt later: {save_me}\n\nPress "enter" to contine...')
gcm.clear() #clears terminal or cmd/powershell window.

data_enc = gcm.stringE(enc_data=data, key=eKey)
gcm.clear()
print(data_enc) # Output is b64 encoded. --> eyJub25jZSI6ICJjQjhpWmc0MWhDWXBRVXdVdW53Q0pRPT0iLCAiaGVhZGVyIjogIlJXNWpjbmx3ZEdWa0lIVnphVzVuSUVkRFRXeHBZaTRnUkU4Z1RrOVVJRlJCVFZCRlVpQlhTVlJJTGlBZ2ZDQWdUV0ZrWlNCaWVTQjBhR1Z5WldGc1QzSnBJQ0I4SUNCaUoxeDRNVE5jZUdKaFhIaGpaVng0TVdWY2VHRTRYSGhsT1VOY2VHRmxKdz09IiwgImNpcGhlcnRleHQiOiAiZ2FDSjY4N2FGVjNMMEIyb01Ecz0iLCAidGFnIjogIkJBUjlmVzkzaWFESnUwckpSU2o3VEE9PSJ9



#Decrypting
data = 'eyJub25jZSI6ICJjQjhpWmc0MWhDWXBRVXdVdW53Q0pRPT0iLCAiaGVhZGVyIjogIlJXNWpjbmx3ZEdWa0lIVnphVzVuSUVkRFRXeHBZaTRnUkU4Z1RrOVVJRlJCVFZCRlVpQlhTVlJJTGlBZ2ZDQWdUV0ZrWlNCaWVTQjBhR1Z5WldGc1QzSnBJQ0I4SUNCaUoxeDRNVE5jZUdKaFhIaGpaVng0TVdWY2VHRTRYSGhsT1VOY2VHRmxKdz09IiwgImNpcGhlcnRleHQiOiAiZ2FDSjY4N2FGVjNMMEIyb01Ecz0iLCAidGFnIjogIkJBUjlmVzkzaWFESnUwckpSU2o3VEE9PSJ9'
b64_enc_key = input("base64 encoded bytes/key made with keygen(): ")
dKey = base64.b64decode(b64_enc_key)

str_dcr = gcm.stringD(dcr_data=data, key=dKey)
gcm.clear()
print(str_dcr.decode('utf-8') # Output is "Hello World <3"

##---------End---------##



Disclaimer

I am not liable or responsible for any data loss or destruction of any kind when using GCMlib. If you lose data and do not have backups then that is solely on you.



Support | Buy me a coffee <3

Donate to me here:

image

Metadata

Release files for GCMlib 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GCMlib 1.0.4
File Size Uploaded
GCMlib-1.0.4.tar.gz 18.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for GCMlib 1.0.4
File Interpreter ABI Platform
GCMlib-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 34.6 kB

Release files / GCMlib-1.0.4.tar.gz

Download URL GCMlib-1.0.4.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
16e3fd6283f2a56abd9cff29d35e9e09a60245a564dc4b74665ac83d25be5738
BLAKE2b-256 checksum
How to use checksums
4781e0799598d3693ae0f3af41424466f15ffda5ef7e486c84f4dd373b49430a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / GCMlib-1.0.4-py3-none-any.whl

Download URL GCMlib-1.0.4-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9738feeb5ed580382ab05c212d830863a35f92ef52f0edd915cb20c934ee3d3
BLAKE2b-256 checksum
How to use checksums
c8b1d98cb708502c7f843d266e66e9bffd8592158b1a65c41665e52afd153a0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page