Skip to main content

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

Project description


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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GCMlib-1.0.4.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

GCMlib-1.0.4-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file GCMlib-1.0.4.tar.gz.

File metadata

  • Download URL: GCMlib-1.0.4.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for GCMlib-1.0.4.tar.gz
Algorithm Hash digest
SHA256 16e3fd6283f2a56abd9cff29d35e9e09a60245a564dc4b74665ac83d25be5738
MD5 2d6b765867c743b968ef16050af25ab1
BLAKE2b-256 4781e0799598d3693ae0f3af41424466f15ffda5ef7e486c84f4dd373b49430a

See more details on using hashes here.

File details

Details for the file GCMlib-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: GCMlib-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for GCMlib-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b9738feeb5ed580382ab05c212d830863a35f92ef52f0edd915cb20c934ee3d3
MD5 e32e81255f8ab311b81c639fa2d92f34
BLAKE2b-256 c8b1d98cb708502c7f843d266e66e9bffd8592158b1a65c41665e52afd153a0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page