I have SSNs in a table as text strings. I'm planning to use CRYPT() on
the web2py app fields that will store these SSNs.
define_table('identity_card'
,Field('person', 'reference auth_user')
,Field('id_type', 'reference valid_id')
,Field('id_number','string',requires=CRYPT()
,Field('id_prefix',compute=lambda r: r['id_number'][:4])
)
The 'id_prefix' field is for human users facilitating person
verification, without having to ask for the full id number. As it is,
the id_prefix will take the first 4 chars of the hashed id number, and
not the original string. Right now I use a custom form that takes in the
id_number, without encryption, take the id_prefix, then encrypt the
id_number and finally do a manual insert into the database.
Is there a way to get the prefix characters before encryption without a
custom form?