Example #1
0
def hash_id_value(hicn):
    """
    Hashes an MBI or HICN to match fhir server logic:
    Both currently use the same hash salt ENV values.
    https://github.com/CMSgov/beneficiary-fhir-data/blob/master/apps/bfd-pipeline/bfd-pipeline-rif-load/src/main/java/gov/cms/bfd/pipeline/rif/load/RifLoader.java#L665-L706
    """
    return binascii.hexlify(
        pbkdf2(hicn, get_user_id_salt(),
               settings.USER_ID_ITERATIONS)).decode("ascii")
def hash_hicn(hicn):
    """
    Hashes a hicn to match fhir server logic:
    https://github.com/CMSgov/beneficiary-fhir-data/blob/master/apps/bfd-pipeline/bfd-pipeline-rif-load/src/main/java/gov/cms/bfd/pipeline/rif/load/RifLoader.java#L665-L706

    """
    assert hicn != "", "HICN cannot be the empty string"

    return binascii.hexlify(pbkdf2(hicn,
                            get_user_id_salt(),
                            settings.USER_ID_ITERATIONS)).decode("ascii")
Example #3
0
 def save(self, commit=True, **kwargs):
     if commit:
         self.user_id_hash = binascii.hexlify(
             pbkdf2(self.user_id_hash, get_user_id_salt(),
                    settings.USER_ID_ITERATIONS)).decode("ascii")
         super(Crosswalk, self).save(**kwargs)
Example #4
0
 def set_hicn(self, hicn):
     self.user_id_hash = binascii.hexlify(
         pbkdf2(hicn, get_user_id_salt(),
                settings.USER_ID_ITERATIONS)).decode("ascii")