Create a hashed string using a cipher code to anonymize a data?

468 Views Asked by At

Say I have a text file with following data:

Name   Year
John Scully   1966
Alex Klaus   1961
....
....

Is there an algorithm or method where I can pass the concatenated first and last name, using birth year as a cipher code to generate an encrypted string for each row.

import some_method 

def encrypt_input(joined_name, year):
    output = some_method(joined_name, year)
    return output

Hypothetical expected output:

Name   Year.   EncryptedString
John Scully   1966   123abcd123456
Alex Klaus   1961   43417hfahg678
....
....

This way I can anonymize the data for each row. Even if someone gets the encrypted string, without the proper Year (the cipher code) it would be possible to generate all possible string but it wont be a meaningful name until all years are tested.

I have looked into AES and encryption algorithm but they only take one cipher code and they are very long and overkill.

I can just write my own function/to work this out, but if there already a library for such work I would like to know. I haven't found any so far.

Looking for solution in python if possible, but any kind of insights is helpful.

0

There are 0 best solutions below