mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-14 04:04:03 +00:00
Add attic
These files are not relevant at all, but helped during research, development, debugging. Hence, don't throw them away, but move them a bit more out of sight.
This commit is contained in:
2
attic/debug_toolbar_resources.txt
Normal file
2
attic/debug_toolbar_resources.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
https://django-debug-toolbar.readthedocs.io/en/latest/installation.html
|
||||||
|
https://stackoverflow.com/questions/6548947/how-can-django-debug-toolbar-be-set-to-work-for-just-some-users/6549317#6549317
|
||||||
49
attic/encryption_test.py
Executable file
49
attic/encryption_test.py
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
|
import django
|
||||||
|
import timeit
|
||||||
|
|
||||||
|
os.environ.setdefault(
|
||||||
|
"DJANGO_SETTINGS_MODULE", "ivatar.settings"
|
||||||
|
) # pylint: disable=wrong-import-position
|
||||||
|
django.setup() # pylint: disable=wrong-import-position
|
||||||
|
|
||||||
|
from ivatar.ivataraccount.models import ConfirmedEmail, APIKey
|
||||||
|
from simplecrypt import decrypt
|
||||||
|
from binascii import unhexlify
|
||||||
|
|
||||||
|
digest = None
|
||||||
|
digest_sha256 = None
|
||||||
|
|
||||||
|
|
||||||
|
def get_digest_sha256():
|
||||||
|
digest_sha256 = ConfirmedEmail.objects.first().encrypted_digest_sha256(
|
||||||
|
secret_key=APIKey.objects.first()
|
||||||
|
)
|
||||||
|
return digest_sha256
|
||||||
|
|
||||||
|
|
||||||
|
def get_digest():
|
||||||
|
digest = ConfirmedEmail.objects.first().encrypted_digest(
|
||||||
|
secret_key=APIKey.objects.first()
|
||||||
|
)
|
||||||
|
return digest
|
||||||
|
|
||||||
|
|
||||||
|
def decrypt_digest():
|
||||||
|
return decrypt(APIKey.objects.first().secret_key, unhexlify(digest))
|
||||||
|
|
||||||
|
|
||||||
|
def decrypt_digest_256():
|
||||||
|
return decrypt(APIKey.objects.first().secret_key, unhexlify(digest_sha256))
|
||||||
|
|
||||||
|
|
||||||
|
digest = get_digest()
|
||||||
|
digest_sha256 = get_digest_sha256()
|
||||||
|
|
||||||
|
print("Encrypt digest: %s" % timeit.timeit(get_digest, number=1))
|
||||||
|
print("Encrypt digest_sha256: %s" % timeit.timeit(get_digest_sha256, number=1))
|
||||||
|
print("Decrypt digest: %s" % timeit.timeit(decrypt_digest, number=1))
|
||||||
|
print("Decrypt digest_sha256: %s" % timeit.timeit(decrypt_digest_256, number=1))
|
||||||
7
attic/example_mysql_config
Normal file
7
attic/example_mysql_config
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
DATABASES['default'] = {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': 'libravatar',
|
||||||
|
'USER': 'libravatar',
|
||||||
|
'PASSWORD': 'libravatar',
|
||||||
|
'HOST': 'localhost',
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user