Input to Hash Algorithm (for 1..9 digit partialTFNs, NOT 10 digit)
The audit uses a hash for partialTFNs of 1 to 9 digits. A full 10 digit partialTFN does not result in a hash, but instead results in the TFT Router returning the TSPID associated with the 10 digit TFN. The rest of this section discusses the hashing for up to 9 digits.
To obtain a hash of a set of data for the audit, the input stream to the hash algorithm can be thought of as a file. A file is not at all required, but it is useful for descriptive purposes below; however the input MUST match the following format, byte for byte, or the hashes will not match.
The format of the file (or input stream) is as follows:
<TFN>,<TSPID>\n
<TFN>,<TSPID>\n
...and so on, one line per active tfn...
<TFN>,<TSPID>\n
The following rules apply:
The number of lines depends on the number of TFNs in the query. A partialTfn of “8” will result in one line for every active TFN in the audit copy DB.
The input MUST be ordered by the TFN, ascending.
The input contains only active TFNs. Inactive TFNs have no representation in the input.
The TFN and TSPID are printable strings like “8005551212” and “12345”.
There is a comma (no spaces) between the fields.
Each [TFN,TSPID] combination terminates with a single carriage return character, \n.
Each TSPID MUST be 5 characters using leading zeros if necessary to ensure 5 characters are present. For example, if the tspid is stored as an integer, 123, it becomes “00123” for the input. (Note that some DBs make padding easy with the LPAD function.)
Like all other lines, the last line has a TFN, TSPID, and single terminating \n character.
The SHA-1 hash MUST use lower case hexadecimal, not upper case.
If there are NO active TFNs in the partialTFN search, then the empty string ("") is hashed (for reference this hash is da39a3ee5e6b4b0d3255bfef95601890afd80709.)
Here is an example MySQL query run on a linux host. This query can be used as a guide for creating a file formatted with the above rules. The query makes assumptions about the DB schema, so modify it as needed. Nevertheless, the reader may find it useful:
$ echo "SELECT CONCAT_WS(',', tollFreeNum, \
LPAD(tspid, 5, '0')) \
FROM MyTollFreeNumTable \
WHERE (tollFreeNum LIKE '8%') \
ORDER BY tollFreeNum" \
| mysql MyDB -u MyUser -p MyPwd \
--disable-column-names \
> myfile.txt
The following file is an example (SampleAuditFile.txt) for the partialTfn “866449894”. Since the partialTfn has only 9 digits the hash is for the range “8664498740” .. ‘8664498749”. For this example, it is assumed that all TFNs have the same TSPID of “01467”. It is also assumed that there are only 4 active TFNs in this range: the TFNs ending in 1,3,7, and 9:
8664498741,01467\n
8664498743,01467\n
8664498747,01467\n
8664498749,01467\n
Here is a hexadecimal dump of the above file to answer any detailed questions the reader may have regarding the input. The hexadecimal dump uses a UNIX tool named “of” which produces hex dumps. The bytes highlighted in red are the hexadecimal values of each byte in the file.
This file becomes input to the SHA-1 hash algorithm. The reader is encouraged to create the file above and apply a SHA-1 hash generator to it to confirm the hash value below. There are several online hash generators available on the web (google “sha-1 generator”). The correct hash for the above file is:
fabd5088a0fc5b1b852b5dbec4c79463e7401c65
If you are working in a linux environment, the following command may be available:
$ sha1sum SampleAuditFile.txt
fabd5088a0fc5b1b852b5dbec4c79463e7401c65 SampleAuditFile.txt
A second example of a file is provided for reference. It has 2 TFNs and one TSPID of 00001:
$ more SampleAuditFile2.txt
8005551212,00001
8005551213,00001
$ sha1sum SampleAuditFile2.txt
821835019eb5daa1f57ed987e09acef41fb7e46a SampleAuditFile2.txt
A final reminder: the file (or input stream) is never exchanged between the TFT Router and the TSS; only the SHA-1 hashes are sent from the TFT Router to the TSS.