ecryptfs_enc...ode_filename(9)
π ecryptfs_encrypt_and_encode_filename β Kernel API Manual, bestie edition β¨
okay so real talk, this is a page from the Kernel API Manual (the header up top is literally ecryptfs_enc...ode_filename(9) β yes the title got squished and truncated, we love a dramatic ellipsis π) and it's all about turning a cute little plaintext filename into cryptographic confetti. let's get into it π
β¨ NAME β¨
ecryptfs_encrypt_and_encode_filename β converts a plaintext file name to cipher text π
like, it takes your readable name and makes it unreadable. glow-up via encryption, no cap.
πΈ SYNOPSIS πΈ
int ecryptfs_encrypt_and_encode_filename (char **encoded_name , size_t
*encoded_name_size , struct ecryptfs_mount_crypt_stat *mount_crypt_stat
, const char *name , size_t name_size );
that's the whole signature, character for character, don't @ me π«Ά
π¦ ARGUMENTS π¦
encoded_nameβ the encrypted name π the function hands it back to you through this pointer-to-pointer, so it's giving main character energy.encoded_name_sizeβ the length of the encrypted name π (yes, you gotta track the size, it's that kind of relationship).mount_crypt_statβ thecrypt_statstruct associated with the file name to encode ποΈ it's the struct that's tied to the name you're encoding.nameβ the plaintext name πΌ your innocent, readable, pre-glow-up filename.name_sizeβ the length of the plaintext name β¨ keep it exact bestie.
π DESCRIPTION π
So what it does: it encrypts and encodes a filename into something that constitutes a valid filename for a filesystem, using printable characters π₯
which is lowkey the whole point β filesystems are picky about what characters they'll accept, so this thing makes sure the encrypted output is all printable and legal. iconic behavior, honestly π
We assume that we have a properly initialized crypto context, pointed to by crypt_stat->tfm π§ so likeβ¦ don't come in here with an uninitialized context, that's not the vibe.
Returns zero on success; non-zero on otherwise β that's it, that's the return value contract. zero = slay, non-zero = something went sideways π
β οΈ heads up: the properly-initialized crypto context pointed to by crypt_stat->tfm is an assumption, not something this function checks for you. read the room (and the code) before calling.
π SEE ALSO π
Kernel file ./fs/ecryptfs/crypto.c β and the whole friend group of related functions, all (9)s, all here, no gatekeeping:
ecryptfs_from_hex(9)ecryptfs_derive_iv(9)ecryptfs_init_crypt_stat(9)ecryptfs_destroy_crypt_stat(9)virt_to_scatterlist(9)crypt_scatterlist(9)crypt_extent(9)ecryptfs_encrypt_page(9)ecryptfs_decrypt_page(9)ecryptfs_init_crypt_ctx(9)ecryptfs_copy_mount_wide_flags_to_inode_flags(9)ecryptfs_set_default_crypt_stat_vals(9)ecryptfs_new_file_context(9)ecryptfs_validate_marker(9)ecryptfs_process_flags(9)write_ecryptfs_marker(9)ecryptfs_code_for_cipher_string(9)ecryptfs_cipher_code_to_string(9)ecryptfs_write_headers_virt(9)ecryptfs_write_metadata(9)set_default_header_data(9)ecryptfs_read_headers_virt(9)ecryptfs_read_xattr_region(9)ecryptfs_process_key_cipher(9)ecryptfs_destroy_crypto(9)ecryptfs_tfm_exists(9)ecryptfs_get_tfm_and_mutex_for_cipher_name(9)ecryptfs_encode_for_filename(9)ecryptfs_decode_from_filename(9)ecryptfs_decode_and_decrypt_filename(9)
like I said β full friend group, all invited to the function party π
and that's the page, bestie π«Ά this one came out of ./fs/ecryptfs in October 2026, filed under the very dramatically truncated name ecryptfs_enc...ode_filename(9). go encrypt something. periodt π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms