Welcome to the forum, @vnd !
Might your question be solved using hash-based k-Anonymity? As I understand it, this approach would:
- prevent Mallory from discovering Alice's birthday;
- prevent Alice from knowing any of the birthdates of her classmates; and
- only allow Alice to discover whether any of her classmates share a birthday with her
Let's suppose Alice has 12 classmates whose data is represented by this table:
()
Bob 11 JAN 2001 a40b69b979ef6af5e9f13a49cfc568d8b942d5c2 a40b6
Joe 23 MAR 1989 4fde4b6b8e077d5b51eed716ab3d94a6ac04c45e 4fde4
Ben 9 JUN 2002 46885da4ffaa4c3d1b31413f96c38f2cb7e895ea 46885
Art 4 DEC 2005 a40b6425e2a7a93a9ac95ee275a5398397c46dd2 a40b6
Tom 17 NOV 1977 a49e374c34333b86ccf08bc10d6e04312e772c41 a49e3
Tim 3 JUL 1989 39e95ac6c6286e6f036822f3fa31131a2e892b08 39e95
Amy 12 FEB 2002 92dac31b3d3a0793fd2845081c93024d0ea8ac8c 92dac
Eva 24 APR 1990 a0ed580e3df29f9a8f22276092ac9f58117401ec a0ed5
Sue 10 JUL 2003 a93703839d02a539c12841f5de2ec8790107925b a9370
Zoe 5 JAN 2006 a40b6232f910b358e971e4c5f91e273c07499ab0 a40b6
Lia 18 DEC 1978 addc1fc5fbe7dea93e3bd1d421521f005ba89c8e addc1
Kay 4 AUG 1990 a4e15e622b89d302f2b0357c2b2efc0d38fba7a0 a4e15
Alice 11 JAN 2001 a40b69b979ef6af5e9f13a49cfc568d8b942d5c2 a40b6
TABLE DATA
This table includes the given name; date of birth (in military format, for cosmetic reasons); the hash value of the birthdate using a non-existent, made up hash (MUH) and the first 5 graphemes of the hash (fragment).
PROCEDURE
. Alice computes the message digest of her birthdate using the made up hash (any hash could be used, even the weak SHA1).
. Rather than communicate the entire hash value to Mallory, which would be perceived as a threat, Alice only gives Mallory a fragment of her hash: the first five graphemes (this is adjustable).
. Mallory knows the dates of birth of everyone in the class, except for Alice. Mallory computes the hash of each classmate's birthday, and returns that data to Alice, but only when Alice's fragment matches the same fragment of a full hash. The data returned does not include the fragment, as this would be redundant.
. Using a 5-grapheme fragment a40b6
, Mallory would give the following data to Alice
9b979ef6af5e9f13a49cfc568d8b942d5c2
425e2a7a93a9ac95ee275a5398397c46dd2
232f910b358e971e4c5f91e273c07499ab0
and Alice would see if her fragment plus any response matches her full hash. In this case, the first one is a match and Alice has her answer. She now knows that someone in her class shares a birthday with her, though she does not know their identity.
In this exchange we see that Mallory, having received only a fragment, cannot determine whether any of the hashes she computed fully match Alice's actual hash, as she has no way of computing Alice's full hash.
The possibility of a threat is eliminated because the decision of whether a match exists cannot be determined by Mallory (hostile server), it can only be determined by Alice (honest client).
Further, using the data supplied by Mallory, Alice cannot deduce the birthdate of any of her classmates except those that match her hash. Partial matches are inconclusive.
The amount of data returned can be adjusted by the size of the fragment:
. Using a single character fragment a
, Mallory would give the following data to Alice:
40b69b979ef6af5e9f13a49cfc568d8b942d5c2
40b6425e2a7a93a9ac95ee275a5398397c46dd2
f9e374c34333b86ccf08bc10d6e04312e772c41
0ed580e3df29f9a8f22276092ac9f58117401ec
93703839d02a539c12841f5de2ec8790107925b
40b6232f910b358e971e4c5f91e273c07499ab0
4e15e622b89d302f2b0357c2b2efc0d38fba7a0
NOTE: This approach does not require us to know how many possible birthdays there are (365). Three hundred or four million, it wouldn't matter.