Open
Description
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
- Fixing bugs - that is easy, doesn't involve
- 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):
...
Metadata
Metadata
Assignees
Labels
No labels