hash_name.proto 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. syntax = "proto3";
  15. package hash_name;
  16. // A request for a single secret whose hash is similar to a desired name.
  17. message HashNameRequest {
  18. // The string that is desired in the secret's hash.
  19. string desired_name = 1;
  20. // The ideal Hamming distance between desired_name and the secret that will
  21. // be searched for.
  22. int32 ideal_hamming_distance = 2;
  23. // A Hamming distance greater than the ideal Hamming distance. Search results
  24. // with a Hamming distance less than this value but greater than the ideal
  25. // distance will be returned back to the client but will not terminate the
  26. // search.
  27. int32 interesting_hamming_distance = 3;
  28. }
  29. message HashNameResponse {
  30. // The search result.
  31. string secret = 1;
  32. // The hash of the search result. A substring of this is of
  33. // ideal_hamming_distance Hamming distance or less from desired_name.
  34. string hashed_name = 2;
  35. // The Hamming distance between hashed_name and desired_name.
  36. int32 hamming_distance = 3;
  37. }
  38. service HashFinder {
  39. // Search for a single string whose hash is similar to the specified
  40. // desired_name. interesting_hamming_distance is ignored.
  41. rpc Find (HashNameRequest) returns (HashNameResponse) {}
  42. // Search for a string whose hash is similar to the specified desired_name,
  43. // but also stream back less-than-ideal candidates.
  44. rpc FindRange (HashNameRequest) returns (stream HashNameResponse) {}
  45. }