| 1 |
// Copyright 2019 the gRPC authors. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
package hash_name; |
| 18 |
|
| 19 |
// A request for a single secret whose hash is similar to a desired name. |
| 20 |
message HashNameRequest { |
| 21 |
// The string that is desired in the secret's hash. |
| 22 |
string desired_name = 1; |
| 23 |
|
| 24 |
// The ideal Hamming distance between desired_name and the secret that will |
| 25 |
// be searched for. |
| 26 |
int32 ideal_hamming_distance = 2; |
| 27 |
|
| 28 |
// A Hamming distance greater than the ideal Hamming distance. Search results |
| 29 |
// with a Hamming distance less than this value but greater than the ideal |
| 30 |
// distance will be returned back to the client but will not terminate the |
| 31 |
// search. |
| 32 |
int32 interesting_hamming_distance = 3; |
| 33 |
} |
| 34 |
|
| 35 |
message HashNameResponse { |
| 36 |
// The search result. |
| 37 |
string secret = 1; |
| 38 |
|
| 39 |
// The hash of the search result. A substring of this is of |
| 40 |
// ideal_hamming_distance Hamming distance or less from desired_name. |
| 41 |
string hashed_name = 2; |
| 42 |
|
| 43 |
// The Hamming distance between hashed_name and desired_name. |
| 44 |
int32 hamming_distance = 3; |
| 45 |
} |
| 46 |
|
| 47 |
service HashFinder { |
| 48 |
|
| 49 |
// Search for a single string whose hash is similar to the specified |
| 50 |
// desired_name. interesting_hamming_distance is ignored. |
| 51 |
rpc Find (HashNameRequest) returns (HashNameResponse) {} |
| 52 |
|
| 53 |
// Search for a string whose hash is similar to the specified desired_name, |
| 54 |
// but also stream back less-than-ideal candidates. |
| 55 |
rpc FindRange (HashNameRequest) returns (stream HashNameResponse) {} |
| 56 |
} |