我有一個函數在我的views.py在某些行我做了一個id的GET請求。 一旦我得到了id,我想要加密該id,然後再解密。 所以我需要兩個功能基本加密()和解密()函數
def encrypt(id):#let say the id is 100
#do something
return encrypted_id # 6-digit let say 985634
def decrypt(encrypted_id): # Here enter 985634
#do something
return decrypted_id # i should get 100
我已經看了很多帖子,但沒有找到一個簡單和乾淨的方式我views.py 這裏申請這個我研究
sha1 : You can't decrypt that (implemented for encryption) Mee 2 M2 . AES it deals with 16-digit that multiple of 8 something
我試着也產生6位數的隨機數,但這個想法也不大。 有人可以告訴方式如何做到這一點?在此先感謝
這裏:http://stackoverflow.com/questions/8554286/obfuscating-an-id – georg 2012-03-21 12:57:54