A Fully Homomorphic String library written in Rust using Zama's tfhe-rs.
The binary given is not meant for production use but rather a proof of concept on how a FHE String library would work. The program takes as cli arguments the string, pattern, n, from and to and runs all supported algorithms and compares their results with the standard string library in Rust. It outputs the time it took as well as if the results match.
The supported string functions are the following:
containswith clear / encrypted patternends_withwith clear pattern / encrypted patterneq_ignore_casefindwith clear pattern / encrypted patternis_emptylenrepeatwith clear / encrypted number of repetitionsreplacewith clear pattern / encrypted patternreplacenwith clear pattern / encrypted patternrfindwith clear pattern / encrypted patternrsplitwith clear pattern / encrypted patternrsplit_oncewith clear pattern / encrypted patternrsplitnwith clear pattern / encrypted patternrsplit_terminatorwith clear pattern / encrypted patternsplitwith clear pattern / encrypted patternsplit_ascii_whitespacesplit_inclusivewith clear pattern / encrypted patternsplit_terminatorwith clear pattern / encrypted patternsplitnwith clear pattern / encrypted patternstarts_withwith clear pattern / encrypted patternstrip_prefixwith clear pattern / encrypted patternstrip_suffixwith clear pattern / encrypted patternto_lowercaseto_uppercasetrimtrim_endtrim_start+(concatenation)- Comparisons between strings
>=,<=,!=,==
cargo b --release$ fhestring --string "hello" --pattern "ello" --n 1 --from "ello" --to "_llo"$ fhestring --help
Finished release [optimized] target(s) in 0.08s
Running `target/release/fhestring --help`
A FHE string implementation using tfhe-rs
Usage: fhestring --string <STRING> --pattern <PATTERN> --n <N> --from <FROM> --to <TO>
Options:
-s, --string <STRING> The string to do the processing on
-p, --pattern <PATTERN> The pattern for the algoritmhs that need it
-n, --n <N> The number of times to make an operation for the algoritmhs that need it
-f, --from <FROM> What will be replaced (for replace algorithms)
-t, --to <TO> What will replace it (for replace algorithms)
-h, --help Print help
-V, --version Print version