We propose quantum cryptography based on an algorithm of determining a function. The security of our cryptography is based on the Ekert 1991 protocol, that is, we use an entangled state. Eve must destroy the entangled state. Consider a function. Alice knows all the mappings concerning the function. Bob knows none of them. His aim is of obtaining all of them without Eve’s attack. In classical case, Bob needs some queries. In quantum case, Bob needs just a query. By measuring the single entangled state, which is sent by Alice, Bob can obtain all the mappings concerning the function, simultaneously. This is faster than classical cryptography.