This is a portable fingerprint interface for strings that will never change. However, it is not suitable for cryptography.
| 78 | // This is a portable fingerprint interface for strings that will never change. |
| 79 | // However, it is not suitable for cryptography. |
| 80 | inline uint64 Fingerprint64(const StringPiece s) { |
| 81 | #ifdef USE_OSS_FARMHASH |
| 82 | return ::util::Fingerprint64(s.data(), s.size()); |
| 83 | #else |
| 84 | // Fingerprint op depends on the fact that Fingerprint64() is implemented by |
| 85 | // Farmhash. If the implementation ever changes, Fingerprint op should be |
| 86 | // modified to keep using Farmhash. |
| 87 | // LINT.IfChange |
| 88 | return farmhash::Fingerprint64(s.data(), s.size()); |
| 89 | // LINT.ThenChange(//third_party/tensorflow/core/kernels/fingerprint_op.cc) |
| 90 | #endif |
| 91 | } |
| 92 | |
| 93 | // 128-bit variant of Fingerprint64 above (same properties and caveats apply). |
| 94 | inline Fprint128 Fingerprint128(const StringPiece s) { |