Hashing
TrustOrder never receives raw personal data. The client normalises each identifier and sends its SHA-256 hash:
hash = lowercase hex( sha256( "trustorder:v1:" + kind + ":" + normalised value ) )kind is email, phone, address or domain. The input is UTF-8. On the wire a hash is exactly 64 lowercase hex characters (^[0-9a-f]{64}$); anything else is rejected with 400. If a value cannot be normalised, send no hash for it.
The same buyer must give the same hash in every shop, so follow the rules exactly. The WooCommerce plugin implements them; the values below let you test your own implementation.
- Unicode NFC, trim white space at both ends, lower case (simple case mapping).
- White space inside the address makes it invalid.
- Exactly one
@. - The domain goes through IDNA (UTS #46, non-transitional) to its ASCII (punycode) form.
- Drop everything from the first
+in the local part. googlemail.combecomesgmail.com; forgmail.comremove every.from the local part.- An empty local part is invalid; the whole address is at most 254 bytes.
| Input | Normalised |
|---|---|
[email protected] |
[email protected] |
[email protected] |
[email protected] |
user@bücher.de |
[email protected] |
- Trim white space; allowed characters are digits,
+, spaces and- / ( ) .. Anything else makes it invalid. - A leading
00becomes+. - Parse it with libphonenumber, using the billing country as the default region (the shipping country if there is no billing country).
06…with regionHUbecomes+36…. - Invalid if libphonenumber says so, if the national number is one repeated digit, or if it is
123456789,1234567or0123456789. - Output in E.164:
+36301234567.
06 30 123 4567, 0630/123-4567 and +36 30 123 4567 (region HU) all give +36301234567.
Address
Section titled “Address”Format: country|postcode|street and house number, from the shipping address.
- Country: ISO 3166 two-letter code, lower case.
- Postcode: remove all white space, lower case, drop trailing dots and a leading
<country>-prefix (forhualsoh-); onlya-z,0-9and-may remain. - Street: from address line 1; if it has no house number, line 1 and line 2 together.
- Remove accents (NFD, drop combining marks), lower case.
- Every character other than
a-z0-9becomes a space; collapse spaces. - A Budapest district prefix (
XIII. ker.) is dropped. - Street types are unified:
u,utca→utca;krt,korut→korut;ter,tr→ter;rkp,rakpart→rakpart;stny,setany→setany;ltp,lakotelep→lakotelep;utstaysut. - Keep the words up to the first number that follows a word: that number is the house number. A single letter right after it is joined to it (
12/A→12a), excepti,vandx(Roman numerals of floors). Floor, door and the second half of10-12are dropped. - Outside Hungary an address may start with the number (
10 Downing Street); then every word is kept.
| Line 1 | Normalised |
|---|---|
Petőfi Sándor u. 12/A 3. em. 5. (HU, 1051) |
hu|1051|petofi sandor utca 12a |
Fő út 3 (HU, 1051) |
hu|1051|fo ut 3 |
Andrássy krt. 10-12. (HU, 1062) |
hu|1062|andrassy korut 10 |
E-mail domain
Section titled “E-mail domain”For disposable e-mail services TrustOrder checks the domain of the address. Send the hash of the punycode domain and of each parent suffix with at least two labels, the most specific first, at most five (email_domain_hashes). x.mailinator.com then cannot slip past a list entry for mailinator.com. If the domain has more than five such suffixes, keep the five least specific.
Check the MX record yourself, in the shop, and send only the result in email_domain_mx (true, false or null if unknown).
Test values
Section titled “Test values”| Kind | Normalised value | Hash |
|---|---|---|
email |
[email protected] |
8cd79ce2224abde026ddc67563fe5edb8b5eb41846c63cd550a76ea76cc2eddd |
phone |
+36301234567 |
038e5821814169825ae568bfefdb18ca31d4d2e0a0f5941b6da27df45d50ddf4 |
address |
hu|1051|petofi sandor utca 12a |
956b4ad633a194c484c3fdd6d6145ec1ac929b211438b3452e79b4853f65df96 |
domain |
gmail.com |
4672a2431309380c7954c449b3ff20d2cd31968853d6e98137dd3b0be3652dae |
domain |
mailinator.com |
d612e31dc021a25d209e94df9ba873a15ed02e08a48782ca56defc5b1710c8e6 |
Quick check in a shell: