Esempio n. 1
0
import base64
from random import randint
from bson import ObjectId
from pymongo import MongoClient
from pyutil.cryptography.rsa.object_coder import ObjectCoder
from pyutil.cryptography.rsa.string_coder import StringCoder

__author__ = 'R.Azh'

password = 123456

object_coder = ObjectCoder(
    "YyxuKKj7ir9NIfbM00C2DfBeTonX7t_uIAa-Vjbyqbg=")  #(Config().secret_key)
hashed_pass = object_coder.encode(password)
hashed_pass2 = object_coder.encode(password)
hashed_pass3 = object_coder.encode(password)

print(hashed_pass)
print(hashed_pass2)
print(hashed_pass3)

passwd = object_coder.decode(hashed_pass)
print(passwd)
passwd2 = object_coder.decode(hashed_pass2)
print(passwd2)

_str = 'test123456'

string_coder = StringCoder("YyxuKKj7ir9NIfbM00C2DfBeTonX7t_uIAa-Vjbyqbg=")
hashed_str = string_coder.encode(_str)
_str = string_coder.decode(hashed_str)