Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hlapi): add strings #1882

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat(hlapi): add strings #1882

wants to merge 1 commit into from

Conversation

tmontaigu
Copy link
Contributor

No description provided.

@cla-bot cla-bot bot added the cla-signed label Dec 16, 2024
@tmontaigu tmontaigu force-pushed the tm/hlstrings branch 2 times, most recently from 9087fcf to 7f541c9 Compare December 16, 2024 16:23
Comment on lines +70 to +74
pub fn try_encrypt_with_padding(
str: impl AsRef<str>,
padding: u32,
client_key: &ClientKey,
) -> crate::Result<Self> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be easier for the users to give the total size instead of the padding count here, so they don't have to compute it from the string size

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could add a try_encrypt_with_fixed_sized which encrypts and padds (or trims) so that the str has the given size

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good idea !


impl FheStringStrip<&Self> for FheAsciiString {
/// If the pattern does match the start of the string, returns a new encrypted string
/// with the specified pattern from the start, and boolean set to `true`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a word ?

}

/// If the pattern does match the end of the string, returns a new encrypted string
/// with the specified pattern from the end, and boolean set to `true`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "stripped" ?


impl FheStringStrip<&ClearString> for FheAsciiString {
/// If the pattern does match the start of the string, returns a new encrypted string
/// with the specified pattern from the start, and boolean set to `true`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

}

/// If the pattern does match the end of the string, returns a new encrypted string
/// with the specified pattern from the end, and boolean set to `true`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

}
}

fn test_string_len_is_empty(client_key: &ClientKey) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have a test where the string is actually empty ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants