You cannot use CRYPT for this purpose. That is a one way hash. The original plaintext cannot be recovered.
You need a symmetric cypher. Web2py comes with the gluon/contrib/aes.py from gluon.contrib.aes import AES key = "your encryption key" IV = ' '*16 db.table.field.filter_in = lambda data,key=key,iv=iv: AES.new(key,AES.MODE_CBC,iv).encrypt(data) db.table.field.filter_out = lambda data,key=key,iv=iv: AES.new(key,AES.MODE_CBC,iv).decrypt(data) On Tuesday, 25 June 2013 06:11:49 UTC-5, lesssugar wrote: > > I have values I would like to store encrypted in my db after user inserts > them. When displayed, the data should get decrypted. > > All I know about encryption in web2py is that it uses HMAC+SHA512 by > default to store password in auth_user table. How do I customize it to > achieve my goal? > > *EDIT* > I found this: *requires=CRYPT(digest_alg='sha512')* - but I think it's > only crating a hash, right? I guess I need a key to encrypt/decrypt. And > how do I get the values in Row object decrypted after I perform a select? > Can't find much about implementing such mechanism in web2py, unfortunately. > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

