Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptographic Algorithms in PyDataStructs #592

Open
czgdp1807 opened this issue Mar 4, 2025 · 3 comments · May be fixed by #676
Open

Cryptographic Algorithms in PyDataStructs #592

czgdp1807 opened this issue Mar 4, 2025 · 3 comments · May be fixed by #676

Comments

@czgdp1807
Copy link
Member

Let's create a fake example (assume that cryptographic algorithms are already there in pydatastructs)

from pydatastructs import crypto

text = "Hello world!"
encrypted_text = crypto.sha256(text, encrypt=True)
decrypted_text = crypto.sha256(text, decrypt=True)
assert(text == decrytpted_text)
print("Encrypted text: ", encrypted_text)

Another example,

from pydatastructs import crypto

text = "Hi there!"
encrypted_text = crypto.sha256(text, key=key, encrypt=True)

Another case is we can have two functions, sha256_encrypt or sha256_decrypt. sha256 with encrypt and decrypt is a bit risky because if by chance we pass incorrect value to encrypt or decrypt then it can mess things up.

sha256_encrypt and sha256_decrypt.

For ChaCha20,

def chacha20(key, nonce, counter):
   ...

or,

def chacha20(key):
    ...
    # nonce and counter will be generated here
  1. Fixing bugs - that is easy, doesn't involve
  2. Adding a new feature - a cryptographic algorithm, a sorting algorithm - figure out how the function signature would look like. sort(list), sort(array), sort(set), sort(iterator), sort(list, reverse=True),
def sort(obj, reverse=False):
    ...

@Susmita331

@ahmed0-07
Copy link

is this an issue to work with or it is related to @Susmita331?

@CrapTheCoder
Copy link

Hey, I'd love to start working on this issue. Can I go ahead? @czgdp1807

@pvprajwal
Copy link

Hi, I would like to work on this @czgdp1807. I presume crypto should come under string algorithms. I'll work on implementing SHA256 and ChaCha20-Poly1305.

Also I'm not sure how sha256 can be decrypted since its a hashing algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants