Page 4 of 4

Re: USing PHP to refer to Form fields in BS AS BB BE fields

Posted: Tue Feb 23, 2021 4:12 pm
by icoso
apmuthu wrote:If you use one way encryption like MD5 or SHA1, there is no way to search in parts.

If you use base64_encoding, you will be able to do so mostly....

Code: Select all

$SSN = '123456789';
echo base64_encode($SSN) . '<br>'; //MTIzNDU2Nzg5
echo base64_encode(substr($SSN,0,3)) . '<br>'; // 123 => MTIz
echo base64_encode(substr($SSN, -3)) . '<br>'; // 789 => Nzg5
You will notice that each character of the SSN will be encrypted as 2 bytes and the search can be done for the base64_encoded value in the base64_encoded string. Pre-arranged salt interspersion can be used for obfuscation.
Can you tell me what you mean by "Pre-arranged salt interspersion can be used for obfuscation"? The base64_encode function doesn't take a SALT. Are you talking about concatenating some other data with the variable before encoding it?

Re: USing PHP to refer to Form fields in BS AS BB BE fields

Posted: Thu Feb 25, 2021 12:49 am
by apmuthu
Yes, concatenating extra characters at specific places and/or those that are not allowed in the encoded string as well and stripping them before decoding.

Re: USing PHP to refer to Form fields in BS AS BB BE fields

Posted: Thu Feb 25, 2021 3:04 am
by icoso
apmuthu wrote:Yes, concatenating extra characters at specific places and/or those that are not allowed in the encoded string as well and stripping them before decoding.
That's what I thought but if you read my prior posts in this thread and others Im STILL trying to figure out how to

1. encrypt a field on my form (cust_SSN) and save it encrypted in the table - this is done and working fine.

2. use the Search field to perform a search on this same cust_SSN field. Nobody seems to be able to help figure out how to change the value of the data entered into the search field BEFORE the search actually runs and then unencrypt the cust_SSN field on the search screen after the records have been retrieved. (Cant really use a variable and/or unique SALT here unless I make one up, because I dont know of a way to have the user enter two search fields (IE: SSN and LAST Name) on the search screen to be able intersperse part of the last name as part of the SALT). The suggested code and examples are not working.